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
Django to FastAPI

We've hit the scaling wall with our decade-old Django monolith. We handle 45,000 requests/minute (RPM) across 1,500+ database tables, and the synchronous ORM calls are now our critical bottleneck, even with async views. We need to migrate to an async-native Python framework.

To survive this migration, the alternative must meet these criteria:

1. Python-Based (for easy code porting).
2. ORM support similar to Django,
3. Stability & Community (not a niche/beta framework).
4. Feature Parity: Must have good equivalents for:
Admin Interface (crucial for ops).
Template system.
Signals/Receivers pattern.
CLI Tools for migrations (makemigrationsmigrate, custom management commands, shell).
5. We're looking at FastAPI (great async, but lacks ORM/Admin/Migrations batteries) and Sanic, but open to anything.

also please share if you have done this what are your experiences

/r/django
https://redd.it/1nq42ez
Transitioning to Python/Django with experience in c, kotlin, and Golang how challenging will it be?

I have some projects I would like to build using Python and Django. I already have experience with C programming, kotlin, and golang mostly in backend and app development.
I'm wondering how challenging it will be to pick up Python for these projects. Will my prior programming experience make the transition smooth and easy, or are there specific pitfalls I should be aware of when moving from languages like C, kotlin, and Go to ppython?


/r/django
https://redd.it/1nprpak
migrating from django to FastAPI

We've hit the scaling wall with our decade-old Django monolith. We handle 45,000 requests/minute (RPM) across 1,500+ database tables, and the synchronous ORM calls are now our critical bottleneck, even with async views. We need to migrate to an async-native Python framework.

To survive this migration, the alternative must meet these criteria:

1. Python-Based (for easy code porting).
2. ORM support similar to Django,
3. Stability & Community (not a niche/beta framework).
4. Feature Parity: Must have good equivalents for:
Admin Interface (crucial for ops).
Template system.
Signals/Receivers pattern.
CLI Tools for migrations (makemigrationsmigrate, custom management commands, shell).
5. We're looking at FastAPI (great async, but lacks ORM/Admin/Migrations batteries) and Sanic, but open to anything.

also please share if you have done this what are your experiences

/r/Python
https://redd.it/1nq45ep
Series of Jupyter notebooks teaching Jax numerical computing library

Two years ago, as part of my Ph.D., I migrated some vectorized NumPy code to JAX to leverage the GPU and achieved a pretty good speedup (roughly 100x, based on how many experiments I could run in the same timeframe). Since third-party resources were quite limited at the time, I spent quite a bit of time time consulting the documentation and experimenting. I ended up creating a series of educational notebooks covering how to migrate from NumPy to JAX, core JAX features (admittedly highly opinionated), and real-world use cases with examples that demonstrate the core features discussed.

The material is designed for self-paced learning, so I thought it might be useful for at least one person here. I've presented it at some events for my university and at PyCon 2025 - Speed Up Your Code by 50x: A Guide to Moving from NumPy to JAX.

The repository includes a series of standalone exercises (with solutions in a separate folder) that introduce each concept with exercises that gradually build on themselves. There's also series of case-studies that demonstrate the practical applications with different algorithms.

The core functionality covered includes:

- jit
- loop-primitives
- vmap
- profiling
- gradients + gradient manipulations
- pytrees
- einsum

While the use-cases covers:

- binary

/r/Python
https://redd.it/1nqe9pj
Python hate on X

Over the past week on X I have seen Python get a lot of hate from the developer community for being incredibly slow compared to other languages like Rust, Java and C#.
Many commented that Python is only good for small projects and that any large projects need to be rewritten in another faster language.
Obviously there have been several large Django based projects, most notably early Instagram.
Do you think Pythons and therefore Django’s relative slowness is overstated?
Does Python’s performance hold back Django usage?

/r/django
https://redd.it/1nq3dxx
Looking for a collaborator

Yooooo, I have been thinking about posting this for a while and I am finally doing it.

I have been building a civic engagement website using Django and HTMX for the past several months, and I am kind of bored of working by myself. I would love to work with someone who has roughly the same experience level as me (I have been learning Python for the last 3 years and Django for almost 2). I am 99% self taught/LLM tutor taught so you will have to pardon some of the copy pasta in the project, but I understand how about 99% of it works. I want to work with someone who wants to create as close to a real world work experience as possible. I have been applying to dev jobs for over a year now with no traction anywhere and I want to make this thing as legit as possible so it looks good on a resume. This is a learning exercise, but there is a possibility of monetization later on.

I am also open to constructive criticism. The goal of this post is to find ways to improve as a developer.

The project is called RepCheck and can be found

/r/django
https://redd.it/1npoetw
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/1nqmont
P How to Check If Your Training Data Is Representative: Using PSI and Cramer’s V in Python

https://preview.redd.it/3m7n4tnu1erf1.png?width=1536&format=png&auto=webp&s=29a717573ec6d3a8d07440b17bd98bf1452ce9a6

Hi everyone,

I’ve been working on a guide to evaluate training data representativeness and detect dataset shift. Instead of focusing only on model tuning, I explore how to use two statistical tools:

Population Stability Index (PSI) to measure distributional changes,
Cramer’s V to assess the intensity of the change.

The article includes explanations, Python code examples, and visualizations. I’d love feedback on whether you find these methods practical for real-world ML projects (especially monitoring models in production).
Full article here: https://towardsdatascience.com/assessment-of-representativeness-between-two-populations-to-ensure-valid-performance-2/

/r/MachineLearning
https://redd.it/1nqkwn4
Help! Cannot Return to Tenant Subdomain After Centralized Login (Django-Tenants Redirect Loop

I'm implementing a multi-tenant application using `django-tenants` and a centralized login model (all users log in on the public schema, like Slack/Discord). I've fixed the initial `NoReverseMatch` error, but I now have a major problem with the post-login redirect.

**The Setup:**

* **Centralized Login:** Handled entirely on the public domain (`localhost:8000`).
* **Protected Tenant Pages:** Any access to a tenant domain (e.g., `manish.localhost:8000/`) requires a logged-in user.
* `LOGIN_REDIRECT_URL` is set to my custom funnel view: `"users:redirect"`.

# The Core Problem: Trapped on the Public Schema

After a user successfully logs in, Django redirects them to the `UserRedirectView` on the **public schema**. This view then tries to send the user to the correct place, but **it cannot break free of the public domain.**

# The Redirect Logic (The Funnel)

This is the view that runs immediately after a successful login:

# savvyteam/users/views.py (UserRedirectView)

class UserRedirectView(LoginRequiredMixin, RedirectView):
permanent = False

def get_redirect_url(self) -> str:
# Check if user should be redirected to organization creation


/r/django
https://redd.it/1nqrmz4
can anyone tell how to we implement Graceful shutdown in flask ? i have tried something but it's too constly thing ?? Any good approach for this thing ?

import signal

from flask import Flask, jsonify, g
import threading

import sys

app = Flask(__name__)

draining = False
requests = set()

lock = threading.Lock()


@app.route("/")
def dummy_request():
import time

time.sleep(30)
print("Taking timee")
return "Hello"


@app.route("/testing")
def dummy_request123():

import time

time.sleep(30)
print("Taking timee")
return "Hello"


@app.before_request


/r/flask
https://redd.it/1nqrosk
Multiple differents models with repetitive fields in DRF API.

I have multiple models with many repetitive fields. I'm planning to have different React forms to populate them.

What is the best path to follow; inheritance or composition? I have followed Claude/ChatGPT tutorials but everytime I get a new blocker some steps ahead.

class House(models.Model):
# Repetitive fields

class Apartment(models.Model):
# Repetitive fields to House model
# plus some differente fields

class Land(models.Model):
# Repetitive fields to House
# plus some differente fields



/r/djangolearning
https://redd.it/1nnboj6
P Give me your one line of advice of machine learning code, that you have learned over years of hands on experience.

Mine is "always balance the dataset using SMOTE, that will drastically increase the precision, recall, f1 etc"

/r/MachineLearning
https://redd.it/1nqtiad
Error during cookie-cutter-django generation

today i wanted to start new project but i get this error every time (using pip and uv install uninstall). help:
ERROR: error during connect: Head "http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine/_ping": open //./pipe/dockerDesktopLinuxEngine: The system cannot find the file specified.

Error building Docker image: Command '['docker', 'build', '-t', 'cookiecutter-django-uv-runner:latest', '-f', 'compose\\\\local\\\\uv\\\\Dockerfile', '-q', '.'\]' returned non-zero exit status 1.

Installing python dependencies using uv...

ERROR: Stopping generation because post_gen_project hook script didn't exit successfully

Hook script failed (exit status: 1)

/r/django
https://redd.it/1nqx7w8
Back to Django after 4 years with FastAPI – what’s the standard for APIs today?

Hey everyone,

I’m coming back to Django after about 4 years working mostly with FastAPI, and I’m trying to catch up with what’s considered “standard” in the Django ecosystem nowadays for building backends and APIs.

From what I see, Django REST Framework (DRF) is still very widely used and seems to remain the go-to choice for REST APIs. At the same time, I’ve noticed Django Ninja popping up as a modern alternative, especially with its FastAPI-like syntax and type hints.

For those of you actively working with Django today:

* Do you still consider DRF the default standard, or is Ninja gaining real adoption in production projects?
* What’s your experience in terms of developer productivity, maintainability, and community support between DRF and Ninja?
* Would you recommend sticking with DRF for long-term stability or trying out Ninja for new projects?

Curious to hear about your experiences and suggestions!

/r/django
https://redd.it/1nr32uj
Proffessional Django Developer

Anyone intrested in collaborating in a django project using databases, docker, Nginx ,redis etc reach out mahn im kinda looking forward to doing something interesting even if its free i don mind

/r/django
https://redd.it/1nqt5kt
We're hiring Full Stack Developer (On-Site)

We're Hiring: Full Stack Engineer (Onsite - Lahore)
Location: Gulberg III, Lahore(Onsite)
Experience: 1-2 years
Key Skills:
Django (Python)
ReactiS
Database knowledge
REST API development
Requirements:
1-2 years of professional Full Stack experience
Strong knowledge of Django & ReactJS
Collaborative mindset for onsite teamwork
Problem-solving attitude & eagerness to learn
If you're passionate about building impactful products in a fast-paced
environment, send your CV to link below.
https://forms.gle/KBu7Moa4GZFuufvE9

https://www.linkedin.com/posts/muhammadusman1993_were-hiring-full-stack-engineer-onsite-activity-7377240542008463361-hw0n?utm_source=social_share_send&utm_medium=android_app&rcm=ACoAABoNHnwBVpOkkxiloXbckwM1O6W_jzpDkMM&utm_campaign=copy_link

/r/django
https://redd.it/1nqvqos
R What do you do when your model is training?

As in the question what do you normally do when your model is training and you want to know the results but cannot continue implementing new features because you don't want to change the status and want to know the impact of the currently modifications done to your codebase?

/r/MachineLearning
https://redd.it/1nr1s6g
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

# Weekly Thread: Resource Request and Sharing 📚

Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!

## How it Works:

1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.

## Guidelines:

Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.

## Example Shares:

1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.

## Example Requests:

1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.

Share the knowledge, enrich the community. Happy learning! 🌟

/r/Python
https://redd.it/1nrgwpe
Django Deployment

I build a django application for my cousin for news article of his city.

For now I build basic CRUD operations without DRF.

Can I Deployment it to the production.

If yes, please guide me how I can do that, and which plateform is good to go with.

/r/django
https://redd.it/1nridh0
How to retrieve and display data from an external API

Hey everyone,


So, I am in the process of creating a web app that is going to fetch data from my companies accounting software and display it. After that, the users want to be able to download the invoices that the fetched data reflects. The users will be able to input search parameters and fetching the data is going to be triggered by a submit button. My questions are:

* How do I fetch the data from the external API through django?
* How do I display the results dynamically?
* How do I then allow the users to select the invoices to be downloaded then download the selected invoices?

I already have the API calls I need for the accounting software, I'm just having a hard time wrapping my head around how to properly use those calls within django to retrieve and display the results in django.


I was thinking of using datatables to display the results and have a checkbox for each invoice the user wants to download. But, if there is a better way to do it, I am all ears.


Any help would be greatly appreciated.

/r/djangolearning
https://redd.it/1nrdp69