Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Monday Daily Thread: Project ideas!

# Weekly Thread: Project Ideas 💡

Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.

## How it Works:

1. **Suggest a Project**: Comment your project idea—be it beginner-friendly or advanced.
2. **Build & Share**: If you complete a project, reply to the original comment, share your experience, and attach your source code.
3. **Explore**: Looking for ideas? Check out Al Sweigart's ["The Big Book of Small Python Projects"](https://www.amazon.com/Big-Book-Small-Python-Programming/dp/1718501242) for inspiration.

## Guidelines:

* Clearly state the difficulty level.
* Provide a brief description and, if possible, outline the tech stack.
* Feel free to link to tutorials or resources that might help.

# Example Submissions:

## Project Idea: Chatbot

**Difficulty**: Intermediate

**Tech Stack**: Python, NLP, Flask/FastAPI/Litestar

**Description**: Create a chatbot that can answer FAQs for a website.

**Resources**: [Building a Chatbot with Python](https://www.youtube.com/watch?v=a37BL0stIuM)

# Project Idea: Weather Dashboard

**Difficulty**: Beginner

**Tech Stack**: HTML, CSS, JavaScript, API

**Description**: Build a dashboard that displays real-time weather information using a weather API.

**Resources**: [Weather API Tutorial](https://www.youtube.com/watch?v=9P5MY_2i7K8)

## Project Idea: File Organizer

**Difficulty**: Beginner

**Tech Stack**: Python, File I/O

**Description**: Create a script that organizes files in a directory into sub-folders based on file type.

**Resources**: [Automate the Boring Stuff: Organizing Files](https://automatetheboringstuff.com/2e/chapter9/)

Let's help each other grow. Happy

/r/Python
https://redd.it/184p0tr
Adding a custom user model after creating a project - how screwed am I?

I've been using Django for about a year and at the start, I thought it was mainly going to be for storing data and the ORM was a big draw, along with ease if setup and use etc.

I didn't really think about setting up a custom user model because at the time, we thought we'd use another system or an API later to put data in but now I want use it to make a proper web app as well.

How hard is it to incorporate a custom user model in an existing project and what things do I need to consider?

/r/django
https://redd.it/184p8if
Help with running flask files

I was given a zip file with lots of other files in it and am trying to run it on my computer. I have Flask and MySQLalchemy installed on my computer. Can anyone help me figure out why it is not running?

Apparently I need dotenv to run flask so I tried installing it

C:\\Users\\name>pip install dotenv

Collecting dotenv

Downloading dotenv-0.0.5.tar.gz (2.4 kB)

Installing build dependencies ... done

Getting requirements to build wheel ... done

Installing backend dependencies ... error

error: subprocess-exited-with-error

× pip subprocess to install backend dependencies did not run successfully.

│ exit code: 1

╰─> [32 lines of output\]

Collecting distribute

Downloading distribute-0.7.3.zip (145 kB)

\-------------------------------------- 145.4/145.4 kB 1.1 MB/s eta 0:00:00

Installing build dependencies: started

Installing build dependencies: finished with status 'done'

Getting requirements to build wheel: started

Getting requirements to build wheel: finished with status 'done'

Preparing metadata (pyproject.toml): started

Preparing metadata (pyproject.toml): finished with status 'error'

error: subprocess-exited-with-error

Preparing metadata (pyproject.toml) did not run successfully.

exit code: 1

[6 lines of output\]

usage: setup.py [global_opts\] cmd1 [cmd1_opts\] [cmd2 [cmd2_opts\] ...\]

or: setup.py \--help [cmd1 cmd2 ...\]

or: setup.py \--help-commands

or: setup.py cmd --help

error: invalid command 'dist_info'

[end of output\]

note: This error originates from a subprocess, and is likely not a problem with pip.

error: metadata-generation-failed

Encountered error

/r/flask
https://redd.it/184skyt
What to do when a FOSS library's namespace is too generic? Is it worth signalling?

Maybe it's the very frustrating last 24 hours talking, but as I found out that pandoc != pypandoc I lost it.

In the Haskell community, there is often talk about namespaces being a community resource, and thus we need to thread carefully when choosing a name for a new project that is publicly available and on one of the language's main package repos.

Does this kind of discussion also exist for Python?

/r/Python
https://redd.it/184oglu
issue with AD auth with two resource group allow

Hi everyone, I am kinda newbie to Django and now I am helping my company to build an AD auth with the web app.
I am using django-auth-ldap for setting it and based on the group of users, they have certain permissions to view the page with Python decorators.

But the issue I am encountering is that users in group A can login and permission are all fine, but for the users in group B, they can log in but it always redirect to the httpforbben page due to the decorator, they cannot access anything. So there is something wrong with the ldap setup in [setting.py](https://setting.py)

​

I tried to used nested group (i.e. group B is under group A) to see if user in group B can access the page but it is still in vain. I now separate it and try to setup something like this in [setting.py](https://setting.py)

AUTH_LDAP_REQUIRE_GROUP = (
LDAPGroupQuery("cn=groupA,ou=windows,ou=GALAXY_TEAM,ou=Applications,o=IAM") |
LDAPGroupQuery("cn=groupB,ou=linux,ou=GALAXY_TEAM,ou=Applications,o=IAM")
)

but still the user in that group cannot login..

does anyone have the experience in setting up ldap permission on multiple groups?

/r/django
https://redd.it/184vt89
How to login to Django views from React?

Currently I am facing an issue where I can sign in from react accurately but my django session is not updated based on whether I login or logout from react.

What I am expecting is that when I sign in through react, my current user view in django will be changed to demonstrate the current user I signed in as from react but at this moment no changes can be seen. Using jwt tokens from react, I am able to access the current user view and get the correct user but this change can only be observed in react and the server side isn't adjusted to have the correct user logged in.

The following image demonstrates my problem: problem

Please provide any help that you can as I have been stuck on this problem for roughly a week now and have been unable to find a solution.

This is how I handle sign ins in react.

//Signs In the user through Django
const handleSignIn = async ()=> {
try {
const response = await axios.post('http://127.0.0.1:8000/api/login/', {


/r/djangolearning
https://redd.it/184xb6g
Difference in setting up test client inside a client fixture

Hi. I'm learning Flask and Python in general, and I'd like to know if these two ways of creating and using a test_client differs in any way? I don't like the nested "with" in the second method. First one seems more clear to me. Both of them works the same as far as I can tell... Are there any downsides of any of them or is this just a matter of preference?

1. ​

​

@pytest.fixture
def client():

app = createapp('../configs/testconfig.py')

with app.appcontext():
try:
db.create
all() # I'm setting up the db for testing purposes here
yield app.testclient()
finally:
db.drop
all()

2.

@pytest.fixture
def

/r/flask
https://redd.it/185324g
Why not Django?

Hi I am nodejs developer who get started this journey with Django. I have a task to make ai/machine learning model for production. As far as I know, 99% of people uses flask or fastapi as their choices. I want to know why and I am away from python world for a long time so I can’t even remember cli commands. I just want to know why and any resources or open source projects from you, thanks.

/r/django
https://redd.it/1853ush
ImportError: cannot import name 'requestctxstack' from 'flask'

Any idea what cause the problem?

==================================================

Traceback (most recent call last):

File "/opt/flask\
apps/runserver.py", line 2, in <module>

from invweb import app

File "/opt/flask_apps/invweb/__init__.py", line 19, in <module>

import invweb.views

File "/opt/flask_apps/invweb/views.py", line 3, in <module>

from flaskext.mysql import MySQL

File "/opt/flask_apps/.venv/lib/python3.10/site-packages/flaskext/mysql.py", line 7, in <module>

from flask import _request_ctx_stack as _ctx_stack

ImportError: cannot import name '_request_ctx_stack' from 'flask' (/opt/flask_apps/.venv/lib/python3.10/site-packages/flask/__init__.py)

===================================================

Requirement.txt content:

====================================================

bcrypt==4.0.1

blinker==1.7.0

click==8.1.7

Flask==3.0.0

Flask-MySQL==1.5.2

itsdangerous==2.1.2

Jinja2==3.1.2

MarkupSafe==2.1.3

PyMySQL==1.1.0

Werkzeug==3.0.1

===================================================

&#x200B;

The server is ubuntu 22.04.04 LTS.

&#x200B;

&#x200B;

&#x200B;

/r/flask
https://redd.it/184yhiq
Looking to hire a Django developer

Hi all,

I'm looking for a Django developer. I don't really trust Indeed or Linkedin because of the bots so I'm deciding to post the job here instead.

A bit about the company

Blendable ([blendable.ca](https://blendable.ca))
We provide insurance and group benefits to employers
Located in Canada

Relevant candidates

Intermediate developer (i.e. not a junior, not a senior)
2-3 years experience with Django
Candidates working from Canada will be given preference

Job details

95k salary
Fully remote
Work your own hours
You'll be collaborating with the rest of the development team to build out our web app.

How to apply

If you're interested, DM me with the following information:

Your name & email
Where you're located
A link to your website/portfolio/resume
Any questions about the role/job

/r/django
https://redd.it/185adey
Tuesday Daily Thread: Advanced questions

# Weekly Wednesday Thread: Advanced Questions 🐍

Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.

## How it Works:

1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.

## Guidelines:

* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.

## Recommended Resources:

* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.

## Example Questions:

1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the

/r/Python
https://redd.it/185hzaf
Google ads API not running on admin pod but is running on celery worker

So basically the title,

I am working on a project where I need to run a custom method in Django admin of some model, in this method I am acquiring a connection to the Google ads API and making a request to create something. While running this method in the admin pod, the process got stuck, but when I made a celery task it was fine and worked just as I expected, this is not the first project that this problem happened to our team, I couldn't find any explanation and I was wondering why did it happen, would love to get you insight on it.

/r/django
https://redd.it/185r1z1