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
server error 500 after depolying on railway

from pathlib import Path
import os
from dotenv import load_dotenv
import dj_database_url

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

load_dotenv()
# testing git
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-3b^6!pu6k5=&s#x^gi7l6^v*(^9mfhw3y+2^owx605$qgekv-e'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

if os.environ.get("ENVIRONMENT") == "production":
ALLOWED_HOSTS = ["ecommerce-production-30e6.up.railway.app","www.elbencs.com","elbencs.com"]
CSRF_TRUSTED_ORIGINS = ["https://ecommerce-production-30e6.up.railway.app","https://elbencs.com","https://www.elbencs.com"]
DEBUG = False
else:
ALLOWED_HOSTS = ["*"]


# Application definition


/r/djangolearning
https://redd.it/1kaojmd
Are the CS50 Courses on YouTube actually helpful?

I still see people recommending the CS50 python courses, especially the Harvard Introduction to Computer Science one, and I noticed that the entire lectures are available for free on YouTube.

To anyone who has done them — how helpful did you find the course? Did it actually give you a good foundation in computer science or python in general?

I’m trying to figure out if it’s worth investing the time, or if there are better alternatives out there for beginners. Any insights or experiences would be appreciated!

/r/Python
https://redd.it/1kaxyu6
Dango Signals Part 2

Surely you must be aware of the ubiquitous design pattern called the **Observer Pattern**, which is often used to implement a signaling mechanism? For your benefit, here's a simple explanation:

This pattern allows an object (the subject) to maintain a list of its dependents (observers) and notify them automatically of any state changes, usually by calling one of their methods. This is particularly useful in scenarios where you want to **decouple** the components of your application.

**Subject**:

The object that holds the *state* and notifies observers about changes. It maintains a list of observers and provides methods to attach and detach them.

**Observer**:

An **interface or abstract class** that defines the method(s) that will be called when the subject's state changes.

**Concrete Subject:**

A class that implements the Subject interface and **notifies** observers of changes.

**Concrete Observer:**

A class that implements the Observer interface and defines the action to be taken when **notified** by the subject.

**Other Related Patterns:**

Event Bus: A more complex implementation that allows for decoupled communication between components, often used in frameworks and libraries.

Signals and Slots: A specific implementation of the Observer pattern used in the Qt framework, where signals are emitted and slots are called in response.

*The Observer Pattern is a powerful way to implement signaling

/r/django
https://redd.it/1kb8hdt
Been creating a script to donwload my Letterboxd watchlist

I'm using Jellyfin and figured it'd be nice to have a way to get the movies from my watchlist in it automatically. So I created this script, you feed it the exported watchlist CSV, and it will download it 1 by 1. One can also enter the name of the movie manually and download it that way. Let me know what you think!

# What My Project Does

A Python script that helps you download movies from your Letterboxd watchlist or by searching for individual movies. The script uses torrents to download movies and includes smart heuristics to try to select the torrent that best matches.

# Target Audience

Letterboxd users who want to get their watchlist downloaded, or just anyone who wants a script to download movies.

# Comparison

I haven't found another tool that does the same.

Github Link: https://github.com/guzmanvig/movie-downloader

/r/Python
https://redd.it/1kb2n71
Codebase extractor using PyQt5 was


I created a PyQt5-based code extractor that scans, filters and exports your entire codebase as Markdown.

GitHub repo: https://github.com/Adco30/CodeExtractor

YouTube demo: https://www.youtube.com/watch?v=nWZmAp8D0sM

What my project does:

Select a project folder or file and CodeExtractor walks the directory hierarchy, applies your exclusion list and extension filters, then displays a collapsible indented view. Language-specific parsers extract class and function signatures for detailed outlines. A Markdown service packages every file’s content into a single document with code fences.

Target audience: all programmers.

Comparison: most tools I have come across leverage the command line interface, whereas mine has a dedicated PyQt5 interface.


/r/Python
https://redd.it/1kb8pnd
Best framework to learn? Flask, Django, or Fast API

"What is the quickest and easiest backend framework to learn for someone who is specifically focused on iOS app development, and that integrates well with Firebase?

/r/Python
https://redd.it/1kbcz7a
Can I realistically "learn" django in 2 months?

I am a data analyst (pandas, openpyxl, SQL) who recently joined a small scale startup.

But it seems like this "Data Analysis" job will "require" me to "learn" Django in 2 months and clear the "Client" interview before the project starts.

Here's what is Client's Requirement:

- Proficiency in backend software development with Python.

Strong understanding of RESTful APIs and microservice architectures.

- Experience deploying and managing services on AWS and GCP.

- Hand-on on Mysql db

- Familiarity with containerization tools (Docker) and CI/CD pipelines.

- Skilled in performance optimisation and debugging in distributed systems.

- Experience implementing design patterns and writing modular, maintainable code.

Knowledge of web servers and distributed systems and its architecture.

Experience with frontend-backend coordination in feature development.

- Familiarity with data pipeline technologies and Al-powered search workflows.

Familiarity with git, GitHub, code review processes ocesses and CI/CD pipelines.



Is it even possible to learn this much and clear the interview?

How do I deal with this situation? Should I quit the job?

/r/django
https://redd.it/1kbg77g
LiveConfig - Live configuration of Python programs

PyPi: https://pypi.org/project/liveconfig/

GitHub: https://github.com/Fergus-Gault/LiveConfig

PLEASE NOTE: The project is still in beta, so there are likely bugs that could crash your program. Not recommended to test on anything critical.

# What My Project Does

LiveConfig allows you to modify instance attributes and variables in real-time. Attributes and variables are saved to a JSON file, where they can be loaded on startup. You can interact with LiveConfig through either a command line, or a web interface.

Function triggers can be added to call a function through the interface of choice.

# Target Audience

LiveConfig could be useful for those developing computer vision projects, machine learning, game engines etc...

It's particularly useful for projects that take ages to load and could require a lot of fine-tuning.

# Comparison

There is one alternative that I have found, LiveTune. I discovered this after I had begun development on LiveConfig, and while certain features like live variables overlap, I think LiveConfig is different enough to be its own thing.


I was inspired to create this project during a recent university course. I had created a program that used computer vision, and every time I wanted to make a small change for fine-tuning, I had to restart the program, which took ages each time.

Feel free

/r/Python
https://redd.it/1kbl1n0
SciMethod: A Django app to manage your research with the scientific method

Hi everyone,

I’d like to share a project I’ve been building for researchers, grad students, and anyone who wants to **structure their work using the scientific method**.

🔬 **SciMethod** is a Django web app designed to walk you through:

* 🧠 Defining research problems
* Creating questions & hypotheses (with Markdown support)
* 🧪 Designing experiments (plans, variables, failure logs)
* 📊 Adding observations and results
* 🌲 Visualizing everything with an interactive **tree view**
* 🔁 Tracking version history automatically (for edits/updates)

# Key Features

* **Markdown editor with LaTeX support** (great for equations!)
* **Version history** for every object (auto-logged)
* **Right-click tree view** to manage the whole research process visually
* **Print-friendly pages** for thesis or documentation
* 📸 Screenshots and code: [GitHub Repo](https://github.com/MShirazAhmad/SciMethod)



# 🙌 Why I built it

As a PhD student, I often felt disorganized tracking changes between hypotheses and experiments. Tools like Notion or Excel weren’t structured enough for scientific workflows.

This is my attempt to **codify the research method itself** into a usable system — version-controlled, extendable, and open-source.



# 💡 How to contribute

I’d love feedback, feature suggestions, or contributions!

→ Fork it, submit issues, or propose PRs to new branches.

Link: [https://github.com/MShirazAhmad/SciMethod](https://github.com/MShirazAhmad/SciMethod)



Would love your thoughts 🙏

Also happy to help anyone interested in adapting it for their own research!

https://preview.redd.it/a3dsjjtcsyxe1.png?width=657&format=png&auto=webp&s=03f0c23d5b462fa240d0114a69c57a415988ec1a

https://preview.redd.it/k7jnasrfsyxe1.png?width=655&format=png&auto=webp&s=dc4e98abcc72442acb142990c54467fe36f2b0d3




/r/django
https://redd.it/1kbf115
Flask app will not start up not matter what I do - Please help - I've been trying for HOURS

/r/flask
https://redd.it/1kbu4j2
How to efficiently call external APIs in DRF?

Hi, I have my own hosting panel which has like 70-100 concurrent users at peak. The whole thing is in DRF and almost every request to DRF calls other external APIs and user needs data from these APIs. I'm using currently requests library and I have some issues when one of the APIs is down (or when there are like 100 users just using panel in the same time). When one of the external APIs is down then whole API built in DRF starts lagging and working very slowly because it hangs on the waiting requests for the response even if there is set timeout like 1 seconds. It's even possible to handle it in other way? I was thiking about making these external API calls async using like celery but user need this data instantly after making request to my DRF API. How to handle this?

/r/django
https://redd.it/1kbpp76
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/1kbv9e0
inline - function & method inliner (by ast)

github: SamG101-Developer/inline

# what my project does

this project is a tiny library that allows functions to be inlined in Python. it works by using an import hook to modify python code before it is run, replacing calls to functions/methods decorated with `@inline` with the respective function body, including an argument to parameter mapping.

the readme shows the context in which the inlined functions can be called, and also lists some restrictions of the module.

# target audience

mostly just a toy project, but i have found it useful when profiling and rendering with gprofdot, as it allows me to skip helper functions that have 100s of arrows pointing into the nodes.

# comparison

i created this library because i couldn't find any other python3 libraries that did this. i did find a python2 library inliner and briefly forked it but i was getting weird ast errors and didn't fully understand the transforms so i started from scratch.

/r/Python
https://redd.it/1kboqlu
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/1kby74x
Send email with Flask

Hello everyone, does anyone know why I can only send emails to my email, which is where the app was created? When I try to send a message to another email, I don't get any error, but the email doesn't arrive. You can see the code in the pictures.

project.config'MAIL_SERVER' = 'smtp.gmail.com'
project.config'MAIL_PORT' = 465
project.config'MAIL_USERNAME' = 'my email'
project.config'MAIL_PASSWORD' = 'app password'
project.config'MAIL_USE_SSL' = True
project.config'MAIL_USE_TLS' = False

Or here:


def renderregistration():
message = ''
if flask.request.method == "POST":
email
form = flask.request.form"email"
numberform = flask.request.form["phonenumber"]
nameform = flask.request.form["name"]
surname
form = flask.request.form"surname"
mentorform = flask.request.form["mentor"]
#User.query.filterby(email =

/r/flask
https://redd.it/1kc4wv1
Help on Flask deployment in Render Web Service

Hello everyone,

Im a noob in Flask. And i have never deployed a web app. Im currently working on a project, which allows bulk uploading to the app. And later on, the client can use it with relative ease, helping his workflow.

I could push my commits up to a certain point. And it kept failing with the same messages: **sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "....." (10...), port ... failed: FATAL: remaining connection slots are reserved for roles with the SUPERUSER attribute**

(at first it was a different message, then it repeated became this message)
Details:

* Flask
* TailWind CSS
* attempted both gunicorn and recently waitress, with no difference in recent result.

I would post my code, but I dont know which part would help. Its quite big already.


Example of commands I ran:

gunicorn -b [0.0.0.0:9000](http://0.0.0.0:9000) 'wsgi:app' -t 300 --keep-alive 300



/r/flask
https://redd.it/1kc0p28
Syd: A package for making GUIs in python easy peasy

I'm a neuroscientist and often have to analyze data with 1000s of neurons from multiple sessions and subjects. Getting an intuitive sense of the data is hard: there's always the folder with a billion png files... but I wanted something interactive. So, I built Syd.

Github: https://github.com/landoskape/syd



What my project does

Syd is an automated system for converting a few simple and high-level lines of python code into a fully-fledged GUI for use in a jupyter notebook or on a web browser with flask. The point is to reduce the energy barrier to making a GUI so you can easily make GUIs whenever you want as a fundamental part of your data analysis pipeline.



Target Audience

I think this could be useful to lots of people, so I wanted to share here! Basically, anyone that does data analysis of large datasets where you often need to look at many figures to understand your data could benefit from Syd.

I'd be very happy if it makes peoples data analysis easier and more fun (definitely not limited to neuroscience... looking through a bunch of LLM neurons in an SAE could also be made easier with Syd!). And of course I'd love feedback on how it works to improve

/r/Python
https://redd.it/1kc3vk6
Creating & Programming Modern Themed Tables in Python using ttkbootstrap Library

I have created a small tutorial on creating a table widget for displaying tabular data using the Tkinter and ttkbootstrap GUI.

Links:

1. Youtube Tutorial : Creating & Programming Modern Themed Tables in Python using ttkbootstrap Library
2. Website/SourceCode : Creating GUI Tables in tkinter using Tableview Class

Here we are using the Tableview() class from the ttkbootstrap to create Good looking tables that can be themed using the ttkbootstrap Library.

The tutorial teaches the user to create a basic table using ttkbootstrap Library , enable /disable various features of the table like Search Bar, Pagination Features etc .

We also teach how to update the table like

1. adding a single row to the tkinter table
2. adding multiple rows to the table,
3. Deleting a row from the tkinter table.
4. Purging the entire table of Data

and finally we create a simple tkinter app to add and delete data.



/r/Python
https://redd.it/1kc60ih
I open-sourced a .po file management system for Django – feedback welcome!

Hi there,

I just open-sourced a tool I built to make managing `.po` files in Django much easier.

The system pushes your translation strings to a cloud-based UI where you can manage and translate them more easily. When you're ready, you can pull the updated translations back into your `.po` files using a simple [`manage.py`](http://manage.py) command.

Django doesn’t have a great native way to manage `.po` files, so I created this to fill that gap. The project is still evolving, the API and UI could use some polish, but it’s already usable and might save you time.

* Website: [https://dj-polyglot.com/](https://dj-polyglot.com/)
* App repo: [https://github.com/Thutmose3/dj-polyglot-app](https://github.com/Thutmose3/dj-polyglot-app)
* Library repo: [https://github.com/Thutmose3/dj-polyglot-lib](https://github.com/Thutmose3/dj-polyglot-lib)

Would love to hear your thoughts or feature suggestions!

/r/django
https://redd.it/1kc1vyd
How to add a unique constraint on a model using only the date part of a DateTimeField?

I have a Django model like this:



class MachineReading(models.Model):
machine = models.ForeignKey(VendingMachine, ondelete=models.CASCADE)
worker = models.ForeignKey(settings.AUTH
USERMODEL, ondelete=models.CASCADE)
counter = models.DecimalField(maxdigits=12, decimalplaces=2)
# ...
created = models.DateTimeField()




I want to ensure there's only one reading per machine per day, but I don’t want to add a separate DateField just for the date part of the created field. Is there a clean way to enforce this at the database level using Django's Meta.constraints or any other approach?

Thanks!

/r/django
https://redd.it/1kccn58