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
First Django Project: Confused About User Registration with Multi-Tenancy

Good evening everyone.
I'm developing a project in Django (it's my first one), and I'm a bit confused about the user registration and login system.

The idea is to have a landing page that includes a form to register both the user and the company, with the following fields:
Username, email, password and company name

This part is already done and working — it saves the data to the database and correctly creates the link between the user and the company.

However, I'm not sure if this is the best approach for user management in Django, since the framework provides a specific library for handling users and authentication.

This project uses a multi-tenant architecture, and that’s what makes me question the best way to implement user registration.

/r/django
https://redd.it/1lyc7km
I keep coming back to flask?

I have tried fastAPI and django, even ventured into other languages like go with gin, PHP with laravel or symfony, elixir with phoenix and ruby with rails. And I think there are some great things going on with some of these projects and technologies. But there is nothing like the ease of development with flask and familiarity. Django has some beautiful design like the admin console and the way it handles migrations but it's a bit of an opinionated beast. FastAPI seems cool in theory but when I built a few services with it it just seems like a toolkit of packages hobbled together. SQLmodel just looks like a thin wrapper around SQLalchemy, and core fastAPI itself is not exactly unlike that around starlette. I also have my opinions on the guy who started the project. Python doesn't really seem like it was built with async in mind in my view, which I am much more inclined to reach to node for if I need, or maybe even look to Go where I don't intentionally have to worry about building async functions.

I'm assuming if you're in this community that you still might use flask to some degree so I understand

/r/flask
https://redd.it/1lyb16a
Sunday Daily Thread: What's everyone working on this week?

# Weekly Thread: What's Everyone Working On This Week? 🛠️

Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!

## How it Works:

1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.

## Guidelines:

Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.

## Example Shares:

1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!

Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟

/r/Python
https://redd.it/1lyevp5
First Django Project: Confused About User Registration with Multi-Tenancy

Good evening everyone, how are you?
I'm developing a project in Django (it's my first one), and I'm a bit confused about the user registration and login system.

The idea is to have a landing page that includes a form to register both the user and the company, with the following fields:
Username, email, password, company name, and ID

This part is already done and working — it saves the data to the database and correctly creates the link between the user and the company.

However, I'm not sure if this is the best approach for user management in Django, since the framework provides a specific library for handling users and authentication.

This project uses a multi-tenant architecture, and that’s what makes me question the best way to implement user registration.

/r/djangolearning
https://redd.it/1lyc6jq
D Has anyone encountered a successful paper reading group at your company?

I work for a B2B ML company, \~200 people. Most of our MLEs/scientists have masters' degrees, a few have PhDs. Big legacy non-tech businesses in our target industry give us their raw data, we process it and build ML-based products for them.

Recently we've started a paper reading group:

ML-inclined folks meet up every few weeks to discuss a pre-agreed-upon paper, which participants (ideally) have skimmed beforehand
One person leads discussion, get the group on the same page about the paper's findings
Spend the rest of the hour talking about the paper's possible application across our company's products

I think a successful paper reading group would mean:

impact ML implementation of existing products
inspiration for completely new products
emergent consensus on what we should be reading next

A few things I'm curious about:

Have you tried this at your company? How long did it last? How do you guys operate it?
Non-barking dogs: as an MLE/DS, I haven't encountered this in my previous companies. I assume because they don't last very long!
How closely should people have read the paper/material beforehand?
If we're all in-person, we could scribble notation/pictures on a big shared whiteboard, great for discussion. But some of

/r/MachineLearning
https://redd.it/1lyetqh
shenzi: A greedy python standalone bundler

# What My Project Does

shenzi creates standalone python applications from your virtual environment, written in Rust. You should be able to ship that folder to any machine (without python installed), and the application should work. It would generate a dist folder, containing the interpreter, all python code and all the shared libraries the code depends on (it adds the whole transitive closure of all shared library dependencies too).

# Target Audience

Developers interested in making python desktop applications.

# Comparison

The use-case is the same as PyInstaller.

There are some differences though:

`shenzi` does not do any static analysis of your source code. The general workflow is to run as much of your application as possible, `shenzi` would intercept all loads during runtime
The idea is to copy the linker as closely as possible. Thats why, shenzi also analyses all shared libraries in the same order as what happened during runtime
`shenzi` is thus more IO intensive compared to PyInstaller, performance can vary due to these differences in the algorithm.
The final application structure is closer to pnpm node_modules structure

My hope is that being faithful to linker might cover a lot of edge cases, I'm not sure if it's the correct approach

/r/Python
https://redd.it/1lybxrk
Mentoring a junior developer

If you were mentoring a junior developer, what would be your best advice to avoid burnout?

Have you suffered any effects?

How did you experiene burnout?

/r/Python
https://redd.it/1lybwgi
Is there a way to get django.conf.settings to autocomplete?

I can't seem to find a good solution to this. I import settings with `from django.conf import settings`, and then when I type `settings.`, I don't see any of my variables. I'm using VSCode. I tried installing django-stubs and pylance, but I'm still not seeing the variables. If I do `from app import settings`, I can see the values. It seems like an extension to show the autocomplete from that path wouldn't be too difficult, but I'm not finding much info on it.

/r/django
https://redd.it/1lyhuwe
web scraping product page python/django

I'm working on a web scraper and trying to figure out if a page is a product page or not. I came up with this script using chatGPT but it still catches non product pages sometimes. Was wondering if any had a full prove script for determining if a page was a product page.

The script:

def isproductpage(soup):
# 1. Structured Product JSON-LD check
for tag in soup.findall("script", type="application/ld+json"):
try:
data = json.loads(tag.string)

# Handle both single object and list of JSON-LD objects
if isinstance(data, list):
data = next((d for d in data if isinstance(d, dict) and d.get("
@type") == "Product"), None)

if isinstance(data, dict) and data.get("
@type") == "Product":
if data.get("name") and data.get("offers") and (
"isOffer" in data.get("offers", {}) or "price" in data.get("offers", {})
):
return True
except Exception:
continue

# 2. Text-based heuristics (stricter)
text = soup.get
text(separator=' ').lower()


/r/django
https://redd.it/1lyns30
Seeking 2 Technical Co-Founders (Equity) - Build AI Navigation for Africa’s Cities

We’re a Nairobi-based startup building an AI-powered urban mobility platform for 2.5M+ daily commuters. Join us as founding mobile developers for significant equity.

What you’ll build:
📍 Real-time navigation engine for informal transit systems
📍 Live mapping with dynamic route optimization
📍 AI-driven tools for low-bandwidth environments
📍 Mass-adoption UI (multi-literacy/language support)

We need:
 Flutter/React Native experts with iOS/Android native experience
 Map SDK pros (Google Maps/Mapbox - live tracking, routes, markers)
 Backend builders (Node.js/Python + Firebase/PostgreSQL)
 AI integrators (third-party APIs, NLP, low-bandwidth optimization)
 Portfolio showing complex shipped mobile apps

You are:
🔥 Passionate about solving Africa’s urban mobility challenges
💸 Comfortable with equity-based compensation (no salary until funding)
🌍 Able to work remotely in agile sprints

Offer:
✔️ Significant founder equity + decision-making power
✔️ Lead architecture of a high-impact solution
✔️ Performance bonuses post-launch

Apply:

1. GitHub/live project links
2. Send to: **investmentsinfinte@gmail.com** (Subject: Reddit Co-Founder)

Confidentiality: Shortlisted candidates sign an NDA before technical briefing. 

/r/Python
https://redd.it/1lyomyb
nuclear-calculator program: emcalc

emcalc is python program but calculating e=mc2, efficiency, led second, watt, and more! more detail:emcalc

/r/Python
https://redd.it/1lyq4en
Target Propagation: A Biologically Plausible Neural Network Training Algorithm

# What My Project Does

Target propagation was a biologically plausible alternative to backpropagation introduced in 2015 by Yoshua Bengio. I implemented the original paper to find out why it did not go mainstream.

# Target Audience

Researchers interested in alternatives to backpropagation and other gradient-based neural network training algorithms

# Comparison

Biologically-inspired alternatives to gradient-based learning include the 

\- forward-forward algorithm (Hinton, 2022),

\- NEAT or Neuro-Evolution of Augmenting Topologies (Stanley & Miikkulainen, 2002),

\- equilibrium propagation (Bengio & Scellier, 2016)

\- direct feedback alignment (Nøkland, 2016)

\- NoPropagation

I compared Target Propagation to backpropagation only and found it super slow tbh.

# Github

Repository: https://github.com/MurageKibicho/Target-Propagation

# Caveats

Target propagation seems unlikely to ever go mainstream. It is rather slow compared to backprop

/r/Python
https://redd.it/1lysa6q
Integrating Telegram bot with Flask

I had a request to integrate Telegram bot with Flask app. I had zero experience with building Telegram bots, didn't follow any tutorials and just started failing fast:

1. I researched existing packages, and it looked like python-telegram-bot is the most polished, feature-rich and well supported. PTB is using async, but hey, I've heard that Flask now supports async, why would I expect any issues?
2. Anyway, without thinking too much I decide to just import PTB as a dependency in Flask project, initialize bot_app, register a webhook as one of the Flask endpoints. It works in dev, I can interact with my app via Telegram, my app can send Telegram messages to notify me about some events, too easy.
3. Then I realize that Flask app in prod runs with 8 Gunicorn workers, and each instance will initialize its own bot_app, each worker will try to register a webhook, it might work or might not work, but it already feels like a questionable design choice and a recipe for disaster, so I start looking for alternative approach.
4. Apart from 8 Gunicorn workers in prod the Flask app also has one special instance which is deployed as a dedicated systemd service, executed as

/r/flask
https://redd.it/1lykzqo
D What are the best industry options for causal ML PhDs?

Hi everyone,

I’m a rising third-year PhD student at a \~top US university, focusing on causal inference with machine learning. As I navigate the intense “publish or perish” culture, I’m gradually realizing that academia isn’t the right fit for me. Now that I’m exploring industry opportunities, I’ve noticed that most of the well-paid ML roles in tech target vision or language researchers. This is understandable, since causal ML doesn’t seem to be in as much demand.

So far, I have one paper accepted at ICML/NeurIPS/ICLR, and I expect to publish another one or two in those venues over the next few years. While I know causal inference certainly provides a strong foundation for a data scientist role (which I could have landed straight out of a master’s), I’d really like a position that fully leverages my PhD training in research such as research scientist or applied scientist roles at FAANG.

What do you think are the most (1) well-compensated and (2) specialized industry roles for causal ML researchers?

Clarification: There are two main flavors of “causal ML” research. One applies machine learning techniques to causal inference problems, and the other incorporates causal structure into core ML methods. My work falls into the first category, which

/r/MachineLearning
https://redd.it/1lyfijr
Flask REST BoilerPlate generator

Hey everyone,

I'm thinking of building a free web app where developers can select features they need for a Flask-RESTful-based backend, and download a ready-to-run ZIP with all boilerplate code.

Some of the options you'd be able to choose from:

Flask-RESTful API structure
Logging (console + file, separate error log)
Firebase Auth integration with decorators
Stripe payment + webhook integration
Plan validation support in API
Request/response logging, HTTP header validation
Basic analytics hooks (with possible analytics storage in Firebase via Celery+Redis)
API endpoint to call different LLMs (mainly OpenAI first to start with).

The idea is that you'd just add your business logic — all the tedious, repeating saas setup is done for you. This is not AI generation, just boilerplate generation based on different selections by the user.

You’d be able to toggle features via UI and get a zip with tailored code + README.

Would something like this be useful to you or your team?
Or is this already being solved better by existing tools (e.g., Bolt, Base44, Lovable)?
Any features you'd love to see included? If this looks useful, I can later add boilerplate for React UI as well, with login/signup/plans/checkout/payment pages and analytics dashboard.

Appreciate your thoughts and feedback! 🙏

/r/flask
https://redd.it/1lykwa6
Flask restx still useful?

I recently noticed that Flask Restx is no longer actively maintained, yet a lot of projects are using it. Is there community interest to revive it?

/r/flask
https://redd.it/1lxwmvd
I hate Microsoft Store

This is just a rant. I hate the Microsoft Store. I was losing my mind on why my python installation wasn't working when I ran "python --version" and kept getting "Python was not found" I had checked that the PATH system variable contained the path to python but no dice. Until ChatGPT told me to check Microsoft Store alias. Lo and behold that was the issue. This is how I feel right now https://www.youtube.com/watch?v=2zpCOYkdvTQ

/r/Python
https://redd.it/1lyz5f6
Proficiency level of mine?

Based on the concepts i know, what is my django proficiency level? Should i call myself a Beginner? Intermediate? or Advanced?

Concepts I currently know:

1. Basic django setup (setting up directories and few settings to run a test server), setting up html template
2. views (which are functions that process data and generate a html page)
3. URL routing
4. Template setup: has html pages
5. Django Admin setup
6. Django Models
7. Django Forms
8. passing context data to templates (to make use of data from the database into the html templates)
9. Usage of Media Files

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