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
What kind of security are you implementing for your Django REST API application?

Hi, I am working on a project. I use Next.js for the frontend and Django for the backend. I use AWS for all the hosting. My question is: what kind of security measures are you using for the Django application? I am reading about OWASP; you can check the link here: OWASP website.

I use 'Ratelimit' for some of my forms.

https://preview.redd.it/acqw9878gkhe1.png?width=1078&format=png&auto=webp&s=6ef9b85ac21b425a0657b2d016742ad56000308d



/r/django
https://redd.it/1ijaaij
SEARCH YOUTUBE AND VIMEO IN ONE PLACE

# I just found this website that let you search for youtube and Vimeos videos, it rank the best videos from the two platforms based on views and quality of the content. It is cool because you search one place and get videos from two different platform

link: http://www.tubesynopsis.com

/r/django
https://redd.it/1ijnlte
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/1ijhini
Any recommendations for an open source Flask repo using pytorch?

Hi, I'd like to play around with some open source Flask project that is using pytorch under the hood. I'm working on a build system and I'd like to test it out with apps that are huge packages like pytorch.



/r/flask
https://redd.it/1ijq279
DjangoMatrix.com - A project I've built in couple of weeks

Hey guys,

just wanted to share with you a project I've built with Django in the last couple of weeks.

The project is about being a one-stop-shop for everything related to Django packages, versioning, compatibilities etc.

You can find more detailed information on the r/Django post I've posted a while ago.

Given that it is open-source, you can scour trough the code and maybe get an "Aha!" moment.
(I'm not saying this is the perfect codebase (or project) I've built, but rather one that I've managed to build and deploy in very little time, and hoping if it gets some traction - we can do many, many improvements!)

p.s. All contributions are welcomed! Feel free to make a PR or report an Issue in the Github repository.

Check it out:
👉 DjangoMatrix.com
👉 GitHub Repository

/r/djangolearning
https://redd.it/1ij1t56
Seniors of django, how did learn the framework?

Hey everyone,

I’m 24 and trying to learn Django, but I’ve been struggling a lot. I have a background in computer engineering and some coding knowledge, but I lack job experience. Whenever I try to study or work on projects, I get tired quickly and lose focus. I also tend to underestimate my skills, which makes learning feel even harder.

On top of that, I feel really alone in this process. I don’t have a support system of people who understand what I’m going through, and I can’t use freelance platforms due to my location. All of this makes it hard to stay motivated, especially when I don’t see immediate progress.

I’m wondering if anyone has been in a similar situation. How do you push through when you feel isolated and discouraged? How do you deal with feeling like you’re not good enough, even when logically you know you’re making progress? Any tips for managing fatigue while studying?

I’d really appreciate any advice or encouragement. Thanks in advance!

P.s: I am interested in coding and developing.



/r/django
https://redd.it/1ijvisj
PyPy v7.3.18 release

>Here's the blog post about the PyPY 7.3.18 release that came out yesterday. Thanks to @matti-p.bsky.social, our release manager! This the first version with 3.11 support (beta only so far). Two cool other features in the thread below.

https://pypy.org/posts/2025/02/pypy-v7318-release.html

/r/Python
https://redd.it/1ijrewd
Handling Multiple Request of Streaming Responses for a Flask App?

Hi,

I'm using Flask for API end points. Front end is just a static site.
I'm currently just on the basic paid tier of pythonanywhere with 2 web workers.
For simple API calls, it is enough.

But currently, I'm implementing a chat gpt streaming completion which takes from 3 to 10 seconds.
With multiple requests, the third user will have to wait for the other user to finish, since there are only 2 web workers. And for the 4th user onwards, I think that would feel like an eternity lol


An obvious solution is to increase the web workers but I only have intermittent multiple request. I don't want to pay for multiple web workers that don't get used.

How do I go about this in pythonanywhere or should I just switch to a different provider? Can you recommend one that allows me to just use a web worker based on demand?

/r/flask
https://redd.it/1ijdfis
init() takes 1 positional argument but 3 were given

Someone Help please I don't know why my code is running on Juptyer

\# DASH Framework for Jupyter

from jupyter_dash import JupyterDash

from dash import dcc

from dash import html

from dash.dependencies import Input, Output

from pymongo import MongoClient

from bson.json_util import dumps

\# URL Lib to make sure that our input is 'sane'

import urllib.parse

\#TODO: import for your CRUD module

from aac_crud import AnimalShelter

\# Build App

app = JupyterDash("ModuleFive")

app.layout = html.Div([

\# This element generates an HTML Heading with your name

html.H1("Module 5 Asssignment - Stephanie Spraglin"),

\# This Input statement sets up an Input field for the username.

dcc.Input(

id="input_user".format("text"),

type="text",

placeholder="input type {}".format("text")),

\# This Input statement sets up an Input field for the password.

\# This designation masks the user input on the screen.

dcc.Input(

id="input_passwd".format("password"),

type="password",

placeholder="input type {}".format("password")),

\# Create a button labeled 'Submit'. When the button is pressed

\# the n_clicks value will increment by 1.

html.Button('Submit', id='submit-val', n_clicks=0),

\# Generate a horizontal line separating our input from our

\# output element

html.Hr(),

\# This sets up the output element for the dashboard. The

\# purpose of the stlye option is to make sure that the

\# output will function like a regular text area and accept

\# newline ('\\n') characters as line-breaks.

html.Div(id="query-out", style={'whiteSpace': 'pre-line'}),

\#TODO: insert unique identifier code here. Please Note:

\# when you insert another HTML element here, you will need to

\# add a comma to

/r/flask
https://redd.it/1ijja7g
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/1ik9pae
Unable to understand flask

Im a beginner in computer science with some experience in pandas, matplotlib, scikit-learn and decided to learn backend.
I started a tutorial and finished it. Did the coding along with tutorial, but I couldn’t understanding why the things are happening like how is things being done under the hood like factory template, user authentication etc , especially flask-sqlalchemy.

I try to read documentation for any issue or thing i wanna implement and do. The sql-alchemy documentation is really shit and I can’t get anything out of it.
As for flask whatever i open has way too many things and everything goes side ways.

In the end i ask gpt to help me and teach me. And it kinda does work, and i understand a bit. But I don’t understand how the underlying things work.
Question is since I’ve completed the tutorial, how can i improve and learn flask very well and understand backend concepts deeply. I am thinking of doing this side by side along with my uni for next four months.

Should i just try to build different projects with the help of gpt or not. I can’t really understand.

/r/flask
https://redd.it/1ik44h2
Best way to get better at practical Python coding

I've noticed a trend in recent technical interviews - many are shifting towards project-based assessments where candidates need to build a mini working solution within 45 minutes.

While we have LeetCode for practicing algorithm problems, what's the best resource for practicing these types of practical coding challenges? Looking for platforms or resources that focus on building small, working applications under time pressure.

Any recommendation is much appreciated!

(Update: removed the website mentioned, not associated with it at all :) )

/r/Python
https://redd.it/1ik0tw7
I have published FastSQLA - an SQLAlchemy extension to FastAPI

Hi folks,

I have published FastSQLA:

Documentation: [https://hadrien.github.io/FastSQLA/](https://hadrien.github.io/FastSQLA/)
Github repo: https://github.com/hadrien/fastsqla

# What is it?

FastSQLA is an SQLAlchemy 2.0+ extension for FastAPI.

It streamlines the configuration and async connection to relational databases using SQLAlchemy 2.0+.

It offers built-in & customizable pagination and automatically manages the SQLAlchemy session lifecycle following SQLAlchemy's best practices.

It is licenced under the MIT Licence.

# Comparison to alternative

fastapi-sqla allows both sync and async drivers. FastSQLA is exclusively async, it uses fastapi dependency injection paradigm rather than adding a middleware as fastapi-sqla does.
fastapi-sqlalchemy: It hasn't been released since September 2020. It doesn't use FastAPI dependency injection paradigm but a middleware.
SQLModel: FastSQLA is not an alternative to SQLModel. FastSQLA provides the SQLAlchemy configuration boilerplate + pagination helpers. SQLModel is a layer on top of SQLAlchemy. I will eventually add SQLModel compatibility to FastSQLA so that it adds pagination capability and session management to SQLModel.

# Target Audience

It is intended for Web API developers who use or want to use python 3.12+, FastAPI and SQLAlchemy 2.0+, who need async only sessions and who are looking to following SQLAlchemy best practices, latest python, FastAPI & SQLAlchemy.

I use it in production on revenue-making projects.

# Feedback wanted

I would love to get feedback:

Are there

/r/Python
https://redd.it/1ikhmtd
Best approach for searching and filtering data?

Hello everyone,

I'm currently developing an Angular/Django application that heavily relies on searching and filtering data. I'm trying to determine the best approach for implementing these features efficiently. Here’s how the app needs to work:

1. Users will have access to an "advanced filtering" option with almost 50 different filters.
- Many of these filters are dropdowns representing the keys of related models.
- The remaining filters are text-based, allowing users to enter keywords or phrases.

For the text-based search filters, I need to be able to handle spelling errors and find matches even when the word order differs (e.g., "large, green, and heavy" vs. "heavy, green, and large"). Also, some text inputs will need to be searched across multiple columns.

2. The app will have two search modes: first one will return only the results that match 100% of the user's filters. The other mode will need to use a scoring system, ranking results by their relevance (e.g., 100% matches first, followed by 90%, 80%, etc.).

3. The table in question has around 3.000 records.

I would love some suggestions about how to implement this, will Django filters be enough? What would be the best way to handle the weighted search? Any recommendations on handling fuzzy search

/r/djangolearning
https://redd.it/1iik49d
Getting information about the fields of a django rest framework view

I'm currently working in a django rest framework project in which users are able to create projects, in the project they can select certain options and assign other users as members. This works fine, but only if you assume the front end already has information about what choices the user can select in each field, including the field where they can select other users (limited to their company). Is there a easy/standard way to give this "form" information to the front end app? What fields are present and their respective types, which ones are mandatory, choices available for each field, etc? I assume there is as this information is present in the browsable API, but I'm not sure how to access it or how to limit the user choices in a given field correctly

Am I supposed to use Metadata for this? If so, how?

/r/djangolearning
https://redd.it/1iir837
A Lightweight Camera SDK for Windows, macOS, and Linux

If you’re looking for a lightweight alternative to OpenCV for camera access on Windows, Linux, and macOS, I’ve created a minimal SDK called lite-camera .

Installation

pip install lite-camera

Quick Usage

import litecam

camera = litecam.PyCamera()

if camera.open(0):

window = litecam.PyWindow(
camera.getWidth(), camera.getHeight(), "Camera Stream")

while window.waitKey('q'):
frame = camera.captureFrame()
if frame is not None:
width = frame0
height = frame1
size = frame2
data = frame3


/r/Python
https://redd.it/1ikizbe
Terminal Task Manager Using Python

I've built a terminal task manager for programmers, that lets you manage your coding tasks directly from the command line. Key features include:

Adding task

Marking tasks as complete

Listing pending task

Listing completed tasks (filter like today, yesterday, week etc)

I am thinking about adding more features like reminder, time tracking,etc. what would you want to see in this task manager. Comment below

I'd love for you to check it out, contribute and help make it even better
The project is available on GitHub https://github.com/MickyRajkumar/task-manager

/r/Python
https://redd.it/1ikipwh
PomdAPI: Declarative API Clients with Tag-Based Caching (HTTP/JSON-RPC) - Seeking Community

Hey everyone,

I’d like to introduce pomdapi, a Python library to simplify creating and caching API calls across multiple protocols (HTTP, JSON-RPC, XML-RPC). It features a clear, FastAPI-like decorator style for defining endpoints, built-in sync/async support, and tag-based caching.

## What My Project Does

- **Declarative Endpoints**: You define your API calls with decorators (@api.query for reads, @api.mutation for writes).
- **Tag-Based Caching**: Tag your responses for easy invalidation. For example, cache getUser(123) under Tag("User", "123") and automatically invalidate it when the user changes.
- **Sync or Async**: Each endpoint can be called synchronously or asynchronously by specifying is_async=True/False.
- **Multi-Protocol**: Beyond HTTP, you can also use JSON-RPC and XML-RPC variants.
- **Swappable Cache Backends** : Choose in-memory, Redis, or Memcached.
Effectively, pomdapi helps you avoid rewriting the usual “fetch => parse => store => invalidate” logic while still keeping your code typed and organized.

## Target Audience

- Developers who need to consume multiple APIs—especially with both sync and async flows—but want a single, typed approach.
- Production Teams wanting a more systematic way to manage caching and invalidation (tag-based) instead of manual or ad-hoc solutions.
- Library Authors or CLI Tool Builders who need to unify caching across various external services—HTTP, JSON-RPC, or even custom protocols.

## Comparison
- Requests + Manual

/r/Python
https://redd.it/1ikjs2s
A new type of interpreter has been added to Python 3.14 with much better performance

Summary: This week I landed a new type of interpreter into Python 3.14. It improves performance by -3-30% (I actually removed outliers, otherwise it's 45%), and a geometric mean of 9-15% faster on pyperformance depending on platform and architecture. The main caveat however is that it only works with the newest compilers (Clang 19 and newer). We made this opt-in, so there's no backward compatibility concerns. Once the compilers start catching up a few years down the road, I expect this feature to become widespread.

Python 3.14 documentation: https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-tail-call


(Sorry can't cross-post here) Original post: https://www.reddit.com/r/ProgrammingLanguages/comments/1ikqi0d/a\_new\_type\_of\_interpreter\_has\_been\_added\_to/

/r/Python
https://redd.it/1iks79k
What is this blank box on the left ? this is on the documentation page of python

Can anyone tell me what is this ??

this is the link : https://docs.python.org/3.13/genindex.html



https://preview.redd.it/r5qpcg242zhe1.png?width=1857&format=png&auto=webp&s=de04daafd00403e68dc3c385d06d3ceb5229eb9c



/r/Python
https://redd.it/1ikwb6i