Daily Python News Question, Tips and Tricks, Best Practices on Python Programming Language Find more reddit channels over at @r_channels
Model vs AbstractUser vs AbstractBaseUser
I'm building a web app that deals with the usual CRUD. A user should be able to sign in, it's data stored in posgresql, and perform login with email and passoword, afterwards. Also, there would be foreign keys as expected and the user might be able to upload files such as images, csv tables and other forms of data science information.
Creating a class model with models.Model is more common, so finding examples and bug soutions are easy. But at same time, people advise against it for new projects, especially with different auth methods (such as using email instead of username for login).
So basically AbstractBaseUser gives more freedom, but it's more complex and easier to make mistakes. And so I'll get much more bugs than now.
Finally, AbstractUser \~\~ Model, I guess. Wich option would be more appropriate and simple to use to build a website as above?
/r/django
https://redd.it/1hs7wzb
How to calculate the resources used by my entire django project
I want to know a way to calculate the resources (cpu and ram) my django project uses; I need that information to know the infrastructure requirements of the server where I will deploy.
/r/django
https://redd.it/1hs8usz
A library for multi-objective community detection
Hello everyone, I've been working on a project for about three months to create an evolutionary algorithm for detecting communities in graphs (as in the example on the link below). I first chose Rust because of its speed, but I ended up exporting it to Python because I didn't see any implementation of this specific tool and I thought it would be interesting to contribute to this project.
My project tries to find communities in graphs using a function that maximizes internal links and minimizes external ones, different from algorithms like Leiden or Louvain that have only one objective function, the target audience is the data science community.
Well, I'm here sharing the library (it's in beta, has some debug prints and is far from being optimized for the Python GIL environment). However, I would like suggestions for what I can improve before releasing a stable version.Lib: https://github.com/0l1ve1r4/re-mocd
/r/Python
https://redd.it/1hrzj5e
I tried to compare FastAPI and Django
Hi there, I’ve written a blog post comparing FastAPI and Django. It’s not about starting a fight, just providing points to help you choose the right one for your next project.
Hope you find it helpful!
/r/django
https://redd.it/1hrs2c3
Ask Reddit: Has anyone used the Frappe Framework?
Hey everyone.
I normally use Django / FastAPI but recently came across Frappe Framework and it seems like a nice way to build internal apps, although it's quite opinionated.
Was just wondering if anyone has any tales operating Frappe apps (outside of ERPNext context)?
/r/Python
https://redd.it/1hrq8qn
Appropriate framework for thesis
Hi everyone!
I'm currently working on my bachelor's thesis in Computer and systems sciences. The focus of my thesis is a comparison of Java and Python in terms of performance and scalability when implementing REST APIs.
For this, I’m using Spring Boot on the Java side. However, I’m unsure which Python framework would be the best equivalent for this comparison. Ideally, it should support REST API development, have a strong community, and be well-suited for performance and scalability testing. So far, I’ve considered Django and Flask, but I’m open to suggestions.
I already know a bit of Flask, but it feels like Flask is a bit too small to offer a fair comparison to Spring Boot.
What do you guys think is the most suitable Python framework to compare with Spring Boot?
/r/Python
https://redd.it/1hrko7z
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
# Weekly Thread: Professional Use, Jobs, and Education 🏢
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
---
## How it Works:
1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.
---
## Guidelines:
- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.
---
## Example Topics:
1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?
---
Let's help each other grow in our careers and education. Happy discussing! 🌟
/r/Python
https://redd.it/1hrgc7f
Looking to Collaborate on Django Projects (Open to Learning and Contributing)
Hi everyone,
I have a working knowledge of Django and a strong enthusiasm to improve my hands-on experience. I'm eager to contribute to any ongoing or new projects involving Django, be it for learning or collaboration purposes.
If you're working on Django and could use an extra pair of hands, I'm ready to help and learn along the way. I'm open to coding, debugging, testing, or any other tasks to contribute to the project.
Feel free to DM me or comment below if you're interested in collaborating!
Looking forward to working with you.
r/django
r/webdev
r/learnprogramming
r/coding
r/developers
/r/djangolearning
https://redd.it/1hr7148
What’s Your Go-To Platform for Hosting Django Projects? 🚀
Hey guys! 👋 I’m curious to know what hosting platforms you’re using for your Django projects. There are so many options out there—AWS, DigitalOcean, Heroku, UpCloud, Linode, Render, Railway, Netlify, Flyio, etc. — each with its pros and cons.
Which ones is the best for you and why?
/r/django
https://redd.it/1hr7sgh
I build a tool that automates testing of a product against its documentation
Happy new year everyone! This is still a proof-of-concept but criticism and some help are very welcome.
As a self-taught coder, I was fed up (and also very inexperienced) writing system and end-to-end tests so I made this. The implementation is a bit convoluted but the basic features are:
1. Writing detailed specs \-- based on existing READMEs, design docs, references, etc.
2. Generating test code \-- in a Python DSL
3. Executing the tests \-- with a DSL interpreter
Step 1 and 2 are enabled by LLMs. You may review and edit the outputs in one text file, and fill in necessary info to properly set up the tests (like describing how data should be validated when the data schema is an implementation detail).
The project is implemented in Python because of the rich dynamic and reflective capabilities of the language. It makes modifying the test code DSL very easy so they may cater to specific test needs.
Target audience: Developers like me who don't like learning about and/or writing system tests.
Comparison:
Cucumber/Gherkin - Unlike Cucumber, you only write minimal code and focus more on fixture data and test environments, which are usually not part of the documentation
Unit/integration tests - This is not a replacement
/r/Python
https://redd.it/1hr4dnu
I made a website to put free tools on it
So, I've started programming a website to put web tools on it like a PNG to JPEG image converter etc, and I'd love your opinion as well as ideas for other tools! :)
here the site : https://javu.xyz/
/r/flask
https://redd.it/1hqasub
dorm: Django wrapper that lets you use its ORM in standalone manner
https://pypi.org/project/dorm-project/
/r/django
https://redd.it/1hqy923
kenobiDB 3.0 made public, pickleDB replacement?
So years ago I wrote the (what I now consider very stupid and useless) program called pickleDB. To date is has over 2 million downloads, and I still get issues and pull request notifications on GitHub about it.
# Comparison
I stopped using pickleDB awhile ago and I suggest other people do the same. For my small projects and prototyping I use another database abstraction I created awhile ago. I call it kenobiDB and tonite I decided to make its GitHub repo public and publish the current version on PyPI. So, a little about kenobiDB:
# What My Project Does
kenobiDB is a small document based database supporting very simple usage including insertion, update, removal and search. It useses YAML, is thread safe, process safe, and atomic.
Here is a stupid example of it in action:
>>> from kenobi import KenobiDB
>>> db = KenobiDB('example.yaml')
>>> db.insert({'name': 'Obi-Wan', 'color': 'blue'})
True
>>> db.search('color', 'blue')
{'name': 'Obi-Wan', 'color': 'blue'}
Check it out on GitHub: https://github.com/patx/kenobi
View the website (includes api docs and a walk-through): https://patx.github.io/kenobi/
# Target Audience
This is an experimental database that should be safe for small scale production where
/r/Python
https://redd.it/1hqvrd6
Stuck in tutorial hell, how to build my first production-ready Django project?
Hey everyone,
I’ve been using Django for about 2 years, mostly building prototypes and small projects, but I’ve just realized... I don’t actually know much about Django or how to build something valuable with it.
Now, I’ve got a client who’s willing to trust me to build a web app for them. It’s not super complex, but I’m kinda freaking out because I don’t know where to start or how to ensure it’s something they’ll actually be happy with.
If you’ve been in my shoes, how did you get over this and deliver something solid? Any tips or resources to help me plan and build this app the right way?
Appreciate any advice you’ve got!
/r/django
https://redd.it/1hqd1yv
D Simple Questions Thread
Please post your questions here instead of creating a new thread. Encourage others who create new posts for questions to post here instead!
Thread will stay alive until next one so keep posting after the date in the title.
Thanks to everyone for answering questions in the previous thread!
/r/MachineLearning
https://redd.it/1hoyxhm
Friday Daily Thread: r/Python Meta and Free-Talk Fridays
# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️
Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!
## How it Works:
1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.
## Guidelines:
All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.
## Example Topics:
1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.
Let's keep the conversation going. Happy discussing! 🌟
/r/Python
https://redd.it/1hs8l05
Help with secretkey
I know I have to set the secret\key using environment variables. I know how to do it. The only problem is that if I were to host my web application on a server, os.environ.get(variable) will no longer know where the variable is present locally on my machine.
Maybe I'm taking the wrong approach or do I need to create some sort of connection from the server to my PC? (although this way I would have to leave it on all the time, and it wouldn't make sense).
/r/flask
https://redd.it/1hrazdo
Calling APscheduler during flask initiation
Hi Everyone,
I am using apscheduler inside my flask application.
Note: I am not using Flask\-APScheduler(flask extension). I am using its standalone library(pip install APScheduler)
========Let me give the context of my application ======================
i am starting my scheduler in create_app() function in application/__init__.py file. My code looks something like this
inside statusPollingScheduler.py file
def getStatusUpdatePollingScheduler():
executors={
'default':ThreadPoolExecutor(1)
}
scheduler = BackgroundScheduler(executors=executors)
scheduler.addjob(
controllerThread,
'interval',
seconds=15,
maxinstances=1,
coalesce=True,
args=(60,) #(timeout,)
)
return scheduler
inside application/init.py file
def startPollingScheduler():
from .statusPollingScheduler import getStatusUpdatePollingScheduler
/r/flask
https://redd.it/1hrrvib
D Monthly Who's Hiring and Who wants to be Hired?
For Job Postings please use this template
>Hiring: [Location\], Salary:[\], [Remote | Relocation\], [Full Time | Contract | Part Time\] and [Brief overview, what you're looking for\]
For Those looking for jobs please use this template
>Want to be Hired: [Location\], Salary Expectation:[\], [Remote | Relocation\], [Full Time | Contract | Part Time\] Resume: [Link to resume\] and [Brief overview, what you're looking for\]
​
Please remember that this community is geared towards those with experience.
/r/MachineLearning
https://redd.it/1hq5o1z
BLIP CAM: Live Image Captioning - Real-Time Video Stream Description Using AI
Showcase
Hey everyone! I've developed a real-time image captioning system that uses your webcam to generate live descriptions of what it sees. It's powered by BLIP (Bootstrapping Language-Image Pre-training) model, and it overlays the captions right on your video feed in real-time.
What My Project Does: This is a Python application that turns on your webcam and starts describing what it sees in real-time. It uses Salesforce's BLIP model to analyze each frame and generate natural language descriptions. The system shows you the caption, frame rate, and even GPU usage right on the screen. You can save frames with their captions, pause the description whenever you want, and it's all optimized to run smoothly on your computer.
Target Audience: This project is perfect for:
Developers working on accessibility tools for visually impaired users
Anyone interested in computer vision and natural language processing
People building smart security systems or educational tools
Developers looking to add automated scene description to their applications
Technical Details: The system uses a multi-threaded architecture to handle video streaming and caption generation separately, ensuring smooth performance. It supports GPU acceleration if you have an NVIDIA card, and you can easily configure things like resolution and caption update frequency. All the core
/r/Python
https://redd.it/1hrnv69
Turn your desktop into your todo list
This is my second project ever and I thought I'd make something I wanted personally.
**What my project does:** This little script will take your todo.txt file and make an image out of it. Then it will set it as your background wallpaper image.
This currently only works for Linux, I'm on Mint XFCE, but it should be really easy to configure to work with other distros or os.I included instructions in the readme on how to add an alias to your bash file so you can just run 'todo' in the terminal and have the wallpaper image update after making changes to your txt file.
**Target Audience:** Anyone looking for help being productive. Anyone like me that gets sidetracked easily when trying to keep multiple small tasks in my head during the day.
**Comparison:** I couldn't find anything like this for Linux that fit my needs, so I can't compare to any other programs honestly.
This is simple and silly but I thought I'd share it in case anyone else wanted something like this.
check it out: https://github.com/CHaagFernandez/Desktop-Todo.git
/r/Python
https://redd.it/1hr9bah
Understanding null=True vs. blank=True
What is the difference between null=True and blank=True in Django models? Can they be used together?
/r/django
https://redd.it/1hr5nez
Quart-Schema 0.21.0 released
[Quart-Schema](https://quart-schema.readthedocs.io/) is a [Quart](https://quart.palletsprojects.com/en/latest/) extension that adds validation (request, response, etc) and autogeneration of OpenAPI documentation using either Pydantic, msgspec, attrs, or dataclasses. For example,
@dataclass
class Todo:
task: str
due: datetime | None
@app.post("/")
@validate_request(Todo)
@validate_response(Todo, 201)
async def create_todo(data: Todo) -> tuple[Todo, int]:
"""Create a Todo"""
# Do something with data, e.g. save to the DB
...
return data, 201
This latest release allows the auto generated OpenAPI schema to be fully customised by [altering Quart-Schema's OpenAPIProvider](https://quart-schema.readthedocs.io/en/latest/how_to_guides/customising.html). For example to use the function name as the operation ID,
class CustomOperationIdOpenAPIProvider(OpenAPIProvider):
def operation_id(self, method: str, func: Callable) -> Optional[str]:
return func.__name__
quart_schema = QuartSchema(app, openapi_provider_class=CustomerOpenAPIProvider)
/r/Python
https://redd.it/1hrd8w0
An alternative to port forwarding for multiplayer functionalities
Hey, I’ve developed an algorithm that strips down ngrok's dynamic URL's into room numbers, to simplify multiplayer connections. It works by converting ngrok-generated links into room numbers, which clients can use to establish connections over the network—no port forwarding required.
This is just a proof of concept for an easy way of adding multiplayer connections into low level games. Currently, it’s in a primitive state as just a chatroom, but the concept could be expanded and integrated into games with further development. If it sparks interest, I’d be happy to continue working on it!
You can check out the project on GitHub: https://github.com/siryazgan/ChatRoom\_OverTheNetwork
What My Project Does:
This project is a network-based chatroom app that simplifies internet connections by utilizing ngrok. It eliminates the need for port forwarding, allowing users to create and join rooms using a room number, which is essentially just a dynamic URL generated by ngrok, stripped down to be a room number. Clients can then use this number to connect to each other and chat over the network. This room number functionality is already widely used in multiplayer games as a common way for players to join sessions.
Target Audience:
This project is for anyone
/r/Python
https://redd.it/1hr8xlo
Is it worth learning Django in 2025?
Hi everyone, and Happy New Year!
I just completed learning Python and recently started exploring Django. I've gone through the basics by following some tutorials, but now I'm at a crossroads.
Should I dive deeper into Django and consider starting my career with it, or would it be better to shift to js and focus on something else, like Node.js or another popular framework?
/r/django
https://redd.it/1hr3wfa
Python / Computer Science Local to my area.
Without doxxing myself, I am looking for other like minded developers in my area. I live in WV, I need to link up with some Python developers close to my area. Feels like out of all my friend groups, Im the only nerd that likes to code.
I am 29, Stay at home dad with 3 kids, but I am also in my sophomore year of college for Computer Science. Why does it seem so hard to find others who like to code?
I enjoy just chillin in discord calls while the homies game and I code, but I need to network more.
/r/Python
https://redd.it/1hqwtif
Django Paginator Fails to generate new pages
from django.core.paginator import Paginator
from .models import Product
global_storage = Paginator(Product.objects.order_by('-created'), 3)
def home(request):
context = {'list_items': global_storage.page(1)}
return render(request, 'index.html', context)
def next_page(request, page_number):
if page_number <= global_storage.num_pages:
context = {'list_items': global_storage.page(page_number)}
return render(request, 'partial_page.html', context)
else:
# send empty response
So initially I had 6 rows in the database and paginator has total two pages. But when I insert +3 rows in the database Django paginator wont generate the new 3rd page. How do i update the pagonator to recognize new rows
/r/django
https://redd.it/1hqv15m
Wednesday Daily Thread: Beginner questions
# Weekly Thread: Beginner Questions 🐍
Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.
## How it Works:
1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.
## Guidelines:
This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).
## Recommended Resources:
If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.
## Example Questions:
1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?
Let's help each other learn Python! 🌟
/r/Python
https://redd.it/1hqr98f
What is the best way to work with Multi-Tenant in Django?
Hello everyone, how are you?
I'm writing SaaS software, in Django and using it as a Full-Stack, including the templates part, I'm using 1 database and at first, all data will be saved in a single database, separated by a TenantID , which will show which "company" that data belongs to.
What is the best way so that, when the user logs in, I only retrieve data relating to that company?
I saw that there is the Django Multi-Tenant package that works with Schemas, but I don't want to use schemas at the moment, I want to use TenantID.
I came from C#, and in EntityFramework (.NET ORM), it is possible to create a global filter that allows filtering by TenantID, thus only bringing information from that "company/tenant", does anyone have any tips?
Cheers.
/r/django
https://redd.it/1hqfwr9
Pydantic-Ai Multi Modal Support Hack
Been playing around with LLMs lately and thought of giving pydantic-ai a try. Pydantic-ai makes working with LLMs a breeze thanks to its features like type safety and structured outputs(Thanks to Samuel Colvin and the Pydantic team), It's perfect for someone like me who loves using Pydantic. While it doesn't have built-in multimodal support yet, I decided to explore a workaround. 🙌
So, I built a quick example showing how to use it with images. Here's how I used it to summarize a resume from a picture: https://github.com/rawheel/Pydantic-ai-MultiModal-Example
Let me know what you think! 💭
/r/Python
https://redd.it/1hqpj8d