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
Made a FastAPI Project Starter

## What My Project Does
I got tired of setting up FastAPI projects from scratch—databases, auth, background tasks, migrations, Docker… so I built a FastAPI project starter. It scaffolds a production-ready project in seconds, including PostgreSQL (async/sync), Celery+Redis, Loguru logging, Docker, middlewares (RequestID, Timer, CORS), Traefik, and MailPit. Post-deployment hooks start services automatically.

## Target Audience
Backend developers who want to quickly spin up production-ready FastAPI projects, small teams, or solo devs who need a consistent setup across projects.

## Comparison
Compared to starting from scratch or using minimal templates, this starter comes pre-configured with essentials like database, background tasks, logging, Docker, monitoring, and middlewares. Unlike other starters, it has post-deployment hooks and multiple middlewares out of the box, saving setup time and reducing errors.

## Links (for reference)
- GitHub: https://github.com/deveshshrestha20/FastAPIProjectStarter
- PyPI: https://pypi.org/project/fastapi-project-starter/


/r/Python
https://redd.it/1np8iyh
Was anyone overwhelmed with official Django tutorial at the start?

This is my first framework I've touched so far. I'm stubborn and won't quit Django but I've been going at the official Django tutorial for the past 4 days and it's just so much. Some of the concepts are confusing and there's so much "magic", don't know how to put it better other than "magic".

Did anyone feel the same when starting out Django? Started with it just because everyone recommended it and feel a bit disheartened that I don't get it straight out the bat, just need some reassurance.

/r/django
https://redd.it/1np9afg
django-vite static assets being served but not loading on an Nginx deployment

Hello everyone, I've been fighting with this problem for 4 whole days to no avail. I'm trying to deploy a simple project on a local ubuntu server VM using docker. I have three containers, Postgres, nginx and Django. I used a lot of HTMX and DaisyUI, and on my dev environment they worked really nicely being served by a Bun dev server and using django-vite, now that I'm deploying, everything works perfectly fine, except for the static assets generated by django-vite. The weirdest part is the files are being delivered to the clients but not loading correctly (the app renders but only the static assets collected by Django, like icons, are being displayed. If I check the network tab on my devtools i see the django-vite files are being served). Any idea what could be causing this?

Here is my vite.config.mjs

import { defineConfig } from "vite";
import { resolve } from "path";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
base: "/static/",
build: {
manifest: "manifest.json",


/r/djangolearning
https://redd.it/1nok0qn
Pyrefly & Instagram - A Case Study on the Pain of Slow Code Navigation

Pyrefly, the new typechecker and language server for Python from Meta, is being battle-tested on Instagram's massive 20M LOC Python codebase. Some of the results have been shared in a new blog post:

> In real world use cases, developers who switched from Pyright (the default LSP for VSCode) to Pyrefly spent 98% less time waiting on hover results and go-to definition was ~10x faster. On the slowest files (p99), these IDE responses grew from an order of minutes to seconds (30x improvement). If those numbers are hard to visualise, the TL;DR is that this upgrade took instagram developers from questioning “is my editor frozen?” to not giving their IDE a second thought.

Full blog post: https://pyrefly.org/blog/2025/09/15/ide-extension/

Disclaimer: I'm one of the maintainers for Pyrefly

/r/Python
https://redd.it/1np9d42
Django Architecture versus FastAPI

After using Django for 10 years, I recently moved to FastAPI. The primary reason revolves around Async I/O, which is possible to do with Django. However, it seems to be easier with FastAPI.

We've been working with college students to give them some development experience. Our company benefits by staying abreast of the latest trends, learning from their wonderful creative ideas and drafting on their awesome energy.

This is the project the students are working with: [FastOpp](https://github.com/Oppkey/fastopp)

Prior to working on FastOpp, all the students were using Django.

These are the shortcomings we encountered with Django:

* **Sync-First Architecture**: Originally designed for synchronous operations
* **Async Retrofitting**: Adding async to existing sync code creates complexity
* **Mixed Patterns**: Developers must constantly think about sync vs async boundaries
* **DRF Complexity**: Additional layer adds complexity for API development
* **Cognitive Overhead**: Managing sync/async transitions can be error-prone

This is a more [detailed comparison](https://github.com/codetricity/htmx-tutorials/tree/main/docs).

As we were experienced with Django, we built tools around FastAPI to make the transition easier. As Django is opinionated and FastAPI is not, we structured the FastAPI tools around our opinion.

Have other people gone on the path of building asynchronous LLM applications with Django and then moved to FastAPI? I would like to hear your experience.

I'll

/r/django
https://redd.it/1npjknw
Teaching my wife python!

Hey fellow redditors, I'm teaching my wife python, and I made a lesson plan to both keep me on track and keep her on track and busy. It seems to be working very well. Sharing it here in case its useful to anyone else. Link

/r/Python
https://redd.it/1nplhop
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/1nps3nn
Stuck on a Flask Security Issue: Is My Session Management Vulnerable?

I've been working on a small Flask web app with a basic user login system, and I'm getting a little paranoid about security. I've read about a few common vulnerabilities and I want to make sure I'm doing things right before I get too far along.
My app connects to a MySQL database and uses Flask's built-in sessions for user authentication. I've read that session cookies should be set to Secure=true and HttpOnly=true to prevent certain attacks, which I've done. I'm also using parameterized queries to prevent SQL injection, which I know is a huge deal.
My main concern is session management, particularly issues like session fixation and brute-force attacks . I'm wondering if a simple login system is enough, or if I need to be more proactive. I want to protect user credentials and prevent unauthorized access.
How do you guys handle things like locking out users after multiple failed login attempts ? What are your go-to security best practices for production-level Flask applications? Any advice on how to ensure my app is secure before it goes live would be a huge help.

/r/flask
https://redd.it/1npvkdf
Does Django JSONField deserialize only when accessed, or immediately when the queryset is executed?

I am trying to determine whether Django's JSONField is deserialized when I access other non-JSON fields in a model instance, or if it only deserializes when the JSONField itself is accessed.

/r/django
https://redd.it/1npzz2a
What small Python automation projects turned out to be the most useful for you?

I’m trying to level up through practice and I’m leaning toward automation simple scripts or tools that actually make life or work easier.

What projects have been the most valuable for you? For example:
data parsers or scrapers
bots (Telegram/Discord)
file or document automation
small data analysis scripts

I’m especially curious about projects that solved a real problem for you, not just tutorial exercises.

I think a list like this could be useful not only for me but also for others looking for practical Python project ideas.

/r/Python
https://redd.it/1nq1588
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