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-cotton, 1+ more reason to start using it.

Coming Soon .... django-cotton/pull/296

>Cotton Directives, a better way to write control flow statements (ifelifelsefor) following django_cotton’s philosophy. These directives use HTML attributes such as c-if and c-for, which can be applied to any HTML element, not limited to Django Cotton components.

<c-avatars>
<c-avatar c-for="user in users">
<c-image c-if="user.photo" :src="user.photo" />
<c-icon c-elif="user.icon" :icon="user.icon" />
<c-initials c-else :name="user.fullname" />
</c-avatar>
</c-avatars>

vs

<c-avatars>
{% for user in users %}
<c-avatar>
{% if
user.photo %}
<c-image :src="
user.photo" />
{% elif user.icon %}
<c-icon :icon="user.icon" />
{% else %}
<c-initials :name="user.full
name" />
{% endif %}


/r/django
https://redd.it/1nhiyh5
3 months in Python, I made my first proper 2D game

What My Project Does:
I’ve been messing with Python for about three months, mostly tutorials and dumb exercises. Finally tried making an actual game, and this is what came out.

It’s called Hate-Core. You play as a knight fighting dragons in 2D. There’s sprites, music, keyboard and touch controls, and a high-score system. Basically my attempt at a Dark Souls-ish vibe, but, you know… beginner style. Built it with Pygame, did the movement, attacks, scoring, and slapped in some sprites and backgrounds.

Target Audience:
Honestly? Just me learn-ing Python. Not production-ready, just a toy to practice, see what works, and maybe have some fun.

Comparison:
Way beyond boring number guessing, dice rolls, or quizzes you see from beginners. It’s an actual 2D game, with visuals, music, and some “combat” mechanics. Dark Souls-ish but tiny, broken, and beginner-coded.

I’d love honest feedback, tips, ideas or anything. I know it’s rough as hell.

Check it out here: https://github.com/ah4ddd/Hate-Core

/r/Python
https://redd.it/1nhfhcs
I built AuthTuna, a modern, async-first security framework for FastAPI with hierarchical permissions

Hey everyone,

I built an async security library for FastAPI called AuthTuna to solve some problems I was facing with existing tools.



# What My Project Does



AuthTuna is an async-first security library for FastAPI. It's not just a set of helpers; it's a complete foundation for authentication, authorization, and session management. Out of the box, it gives you:

* **Fully async** operations built on SQLAlchemy 2.0.
* **Hierarchical RBAC** for complex, nested permissions (e.g., `Organization -> Project -> Resource`), which goes beyond simple roles.
* **Secure, server-side sessions** with built-in hijack detection.
* A familiar developer experience using standard FastAPI `Depends` and Pydantic models.



# Target Audience



This is built for Python developers using FastAPI to create **production-grade applications**. It's specifically useful for projects that need more complex, granular authorization logic, like multi-tenant SaaS platforms, internal dashboards, or any app where users have different levels of access to specific resources. It is not a toy project and is running in our own production environment.



# Comparison



I built this because I needed a specific combination of features that I couldn't find together in other libraries.

* **vs. FastAPI's built-in tools:** The built-in security utilities are great low-level primitives. AuthTuna is a higher-level, "batteries-included" framework. You get pre-built user flows, session management,

/r/Python
https://redd.it/1nhn589
DAAAI 2026 phase1

I’ve seen a strange situation that many papers which got high scores like 6 6 7, 6 7 7 even 6 7 8 are rejected, but some like 4 5 6 even 2 3 are passed. Do anyone know what happened?

/r/MachineLearning
https://redd.it/1nhpwwn
Do I really need to learn Django templates if I want to do backend dev?

Hey everyone, I’m currently learning backend development with Django and I’m a bit confused about where templates fit in.

Here’s my thought process so far:
1. Django can return HTML pages using its built-in template system. This is the traditional server-side rendering (SSR) model that a lot of older frameworks also used (PHP, Ruby on Rails, Java JSP, etc.).
2. Nowadays, many apps use client-side rendering (CSR) with React, Vue, etc. In that case, the backend usually just provides a JSON API and the frontend handles rendering.

So my question is: If I want to focus mainly on backend development in Django, do I still need to learn templates?

/r/django
https://redd.it/1nhl9wo
I made a vs code extension that insults you if you copy & paste AI generated code

-on an important note: this project was just for fun, I'm not against using AI to help your coding sessions-


What my project does:
It's a vs code extension that gives random insults such as "Do you ask GPT what to eat for dinner as well?" to the user if it detects AI generated content. It uses a pretrained transformer-based model for inference (roberta-base-openai-detector), that returns the probability of human and AI writing the given section of text. It was pretty fun to play around with, although not accurate (the model was trained on GPT-2, and not optimized for code, so accuracy is bum), but it was my first time mixing languages together to create something. (In this case typescript and python) It's interesting how extensions like these are set up, I think it's valuable for anyone to do pet projects like these.


Target audience: noone really, just a funny pet project, due to the inaccuracy I wouldn't recommend it for actual usage (it's a bit difficult to create something more accurate, these kind of open-source models were trained on texts, not code)


Comparison: To my knowledge there hasn't been a vs code extension like this before, but there are several much more

/r/Python
https://redd.it/1nhtowu
How to block a domain from accessing my website?

There is this domain, lets call it example.com. It has pointed it's ip to my Django site. Because of ALLOWED_HOSTS, they are just seeing an error.


But i want to block them all together since they are sending plenty of requests as well. How do i do this? Using cloudflare

/r/django
https://redd.it/1nhzv09
Random 404 errors.

I am a beginner, and my Flask app is randomly giving 404 URL not found errors. It was running perfectly, and I restarted the app, but now it is not. Last time it happened, I just closed my editor and shut my pc off, and after some time, it was working again.

I know my routes are correct, and I am using url_for and even my Index page, which i donet pass any values into, is not loading.

Has Anyone else faced these issues before and know how to solve them?

/r/flask
https://redd.it/1nhjxbx
NOW - LMS: A flask based learning platform

<tl-dr>


# Python >= 3.11
# Sources:https://github.com/bmosoluciones/now-lms
# License: Apache 2
python3 -m venv venv
venv/bin/pip install now_lms
venv/bin/lmsctl database init
venv/bin/lmsctl serve
# Visit `http://127.0.0.1:8080/` in your browser, default admin user and password are `lms-admin`.

</tl-dr>


Hello, this is a project I have been working to release a online learning plataform for my sister use and my use.

NOW - LMS is designed to be simple yet powerful. Here are its key features:

* **Clean codebase**: Python and HTML5.
* **Compatible with multiple databases**: SQLite, PostgreSQL, and MySQL.
* **Complete course creation functionality**, allowing full curriculum setup.
* **Courses are organized into sections**, which group resources in a logical manner.
* **Flexible resource types** within a course section:
* YouTube videos
* PDFs
* Images
* Audio files
* Rich text content
* External HTML pages
* Slide presentations
* External resource links
* **Course types**:
* Free or paid
* Self-paced, synchronous (with tutor), or time-limited
* **Paid courses support an audit mode**, allowing limited

/r/flask
https://redd.it/1ngwce6
Tuesday Daily Thread: Advanced questions

# Weekly Wednesday Thread: Advanced Questions 🐍

Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.

## How it Works:

1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.

## Guidelines:

* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.

## Recommended Resources:

* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.

## Example Questions:

1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the

/r/Python
https://redd.it/1ni2d07
What’s the one Python feature you wish you discovered earlier?

I’ve been coding in Python for a few years, and just recently realized how much time f-strings can save compared to old-style string formatting.

Honestly, I feel like I wasted so many lines of code before discovering this. 😅

Curious — what’s one Python trick, library, or feature that completely changed how you code once you found it?

/r/Python
https://redd.it/1ni9puj
Looking for a study buddy(woman)

I need accountability buddy. I have multiple unfinished projects. my suggestion is to have study sessions together every day. It would create some external structure and responsibility. My tz is gmt+5. I am 31f

/r/djangolearning
https://redd.it/1nhmwg9
D - NeurIPS 2025 Decisions

Just posting this thread here in anticipation of the bloodbath due in the next 2 days.

/r/MachineLearning
https://redd.it/1nie5rl
Why do you like/hate Django?

Hello! I'd like to hear different opinions about this framework.
Why do you like it or why do you hate it.

Everyone has a free space to share their opinions about it!

PS: you don't have to motivate me on why i should or shouldn't use it, i'm already using it for work. This doesn't mean i have a love feeling tho 😂, so i want to read everyone's opinions!

/r/django
https://redd.it/1nil9zn
[P] I build a completely free website to help patients to get secondary opinion on mammogram, loading AI model inside browser and completely local inference without data transfer. Optional LLM-based radiology report generation if needed.

https://redd.it/1nirhbj
@pythondaily
AIWAF Flask: Drop in Security Middleware with AI Anomaly Detection

Just launched AIWAF Flask, a lightweight yet powerful Web Application Firewall for Flask apps. It combines classic protections like IP blocking, rate limiting, honeypot timing, header validation, and UUID tampering checks with an AI powered anomaly detection system. Instead of relying only on static rules, it can learn suspicious patterns from logs and dynamically adapt to new attack vectors.

The setup is dead simple. By default, just pip install aiwaf-flask and wrap your Flask app with AIWAF(app) and it automatically enables all seven protection layers out of the box. You can go further with decorators like aiwaf_exempt or aiwaf_only for fine grained control, and even choose between CSV, database, or in memory storage depending on your environment. For those who want smarter defenses, installing with [ai] enables anomaly detection using NumPy and scikit-learn.

AIWAF Flask also includes a CLI (aiwaf) for managing IP blacklists/whitelists, blocked keywords, training the AI model from logs, and analyzing traffic patterns. It’s designed for developers who want stronger security in Flask without a steep learning curve or heavy dependencies.

aiwaf-flask · PyPI

/r/flask
https://redd.it/1niw2ii