I wrote some flask code. Would anyone be willing to review the code I wrote. Everything works I just want to get someone opinion of the code. If yes I will private message you the code.
I wrote some flask code. Would anyone be willing to review the code I wrote. Everything works I just want to get someone opinion of the code. If yes I will private message you the code.
/r/flask
https://redd.it/1f3m6g7
Building a Custom Paint Store: Time and Cost Estimation for Advanced Color Matching API Development
https://preview.redd.it/2609503u0lld1.png?width=1280&format=png&auto=webp&s=dd1d3d37e597ea224ae26fd73b342bebed70cbd3
https://preview.redd.it/u4ybjkou0lld1.png?width=420&format=png&auto=webp&s=f8287bb1588e09b485532817698637c8a11b7eeb
I'm developing a website for selling construction paints. For the past two weeks, I've been working with an assistant to create a color palette like the one in the first screenshot. We've also implemented a color input field that checks both our color palette and the palettes of competitors (everything is legal, it's just to ensure the correct spelling of color names and numbers from other companies, in case a customer wants our paint but with a color from another brand, without any trademark or copyright issues). This is the basic functionality we have right now.
Here's the new functionality described in the third screenshot (which I photoshopped for now):
1. Implement a color search feature.
2. Display similar colors.
3. Show the selected color and a room in that color.
4. Below that, display other room options. When a user clicks on a room, they will see it in the selected color (the image won't be pre-prepared; the room will be recolored in the selected color using code, and the recolored room image will be saved. There will be 8,000-10,000 colors and 6-8 room images).
5. Add the ability for users to upload their own room images, select walls, and have them recolored
/r/Python
https://redd.it/1f3z83t
We just open sourced! Launch websites, APIs, and workers to AWS / GCP with Python
Hey everyone, my team and I spent the last 6 months refactoring our DevOps platform into an open source deployment tool for AWS / GCP - LaunchFlow.
GitHub repo: https://github.com/launchflow/launchflow
Docs: https://docs.launchflow.com/
What My Project Does
The Python SDK lets you launch websites, APIs, and workers to AWS / GCP with minimal configuration—no messy YAML required.
Networking, permissions, and other environment configurations are automatically handled for you. It only takes one line of code to deploy static sites, serverless APIs, managed Postgres, Kubernetes clusters, and more.
Target Audience:
Developers building on AWS / GCP.
LaunchFlow is not just for deploying Python applications.
The Python SDK is used to define your infrastructure in code, but you can deploy any static or Dockerized application to AWS or GCP.
Python is just the language for your cloud configuration, similar to how Terraform uses HCL.
Comparison:
LaunchFlow is most commonly compared to CDK for Terraform and Pulumi.
LaunchFlow is a higher-level abstraction than both of these tools. It provides a more opinionated way to define your infrastructure and handles things like networking, security, and environment management out of the box.
We’re also going much deeper on “deployments” than other IaC tools do. Terraform / Pulumi are typically paired with a separate deployment tool, whereas LaunchFlow combines release management with the
/r/Python
https://redd.it/1f3hexb
Python Zen and implications
I was encouraged to reconsider my understanding the true implications of some of the Python Zen design principles, and started questioning my beliefs.
In particular "Explicit is better than implicit
". Pretty much all the examples are dead-trivial, like avoid "import *" and name your functions "read_something" instead of just "read".
Is this really it? Has anyone a good coding example or pattern that shows when explicit vs. implicit is actually relevant?
(It feels that like most of the cheap Zen quotes that are online, in which the actual meaning is created "at runtime" by the reader, leaving a lot of room for contradictory interpretations)
/r/Python
https://redd.it/1f3pbet
Documentation difficult to navigate
I find Django documentation VERY annoying to navigate. Everything seems to be explained "by example" and actual reference overviews are hard to find. I feel like the documentation reads like one long tutorial on everything that Django has, but it leaves out many details that I would want to know, as I really don't like much "magic" happening in my code and the Django framework itself already introduces enough of that.
For example, the IntegerChoices class of Django models: I can't find it through the search bar, it is NOT in the General Index, but it is mentioned in the examples in the IntegerFields documentation under enumeration types. How would I have been able to find this if I encountered this class and wanted to look it up? Visit every possible related page and ctrl+F?
I just want to see for every class an overview of its member functions, what goes in, what comes out and which type everything is supposed to be in an exact, unambiguous way, like most other documentation of anything else ever. I don't want to read a book when I quickly want to find something...
Am I the only one annoyed
/r/django
https://redd.it/1f39njx
problem routing the urls for my django ninja api
from .models import Order, OrderItem
from ninja import Router,NinjaAPI
from django.shortcuts import getobjector404
from ninja import Schema
from products.models import Product
api = NinjaAPI()
router = Router()
class OrderSchema(Schema):
id: int
userid: int
products: listint
totalprice: int
shippingaddress: str
createdat: str
updatedat: str
ordernumber: str
class OrderCreateSchema(Schema):
products:list[int]
totalprice:int
status:str
# list
router.get("/orders/", response=listOrderSchema)
def listorders(request):
order = Order.objects.all()
return order
@router.get("/orders/{orderid}/", response=OrderSchema)
def getorder(request, orderid:int):
/r/djangolearning
https://redd.it/1f2o6hc
Broken Pipe Error using SQLAlchemy for Redshift connection
I am running a rather simple Flask App with the goal of displaying Redshift database tables to users of the App. The App User model is also stored as a database table in Redshift with usernames, id's etc. (not much security is needed for this so it's fine).
The app is deployed in a Docker container in [AWS ECS](https://aws.amazon.com/ecs/).
**The problem:**
Upon first deployment of the App everything works fine (login, accessing all routes, viewing the tables etc.). When i log out of the App with my user and close the browser and then try to login again a couple of hours later I get the following Error in my logs:
[2024-08-27 09:43:02 UTC]: LOG: Login attempt for user: user01
[2024-08-27 09:43:02 UTC]: LOG: Querying database for user01: user01/usr/local/lib/python3.9/dist-packages/sqlalchemy/engine/default.py:736: UserWarning: DB-API extension cursor.connection used
cursor.execute(statement, parameters)
[2024-08-27 09:43:02 UTC]: LOG: Error querying database for user user01: (redshift_connector.error.InterfaceError) BrokenPipe: server socket closed. Please check that client side networking configurations such as Proxies, firewalls, VPN, etc. are not affecting your network connection.
(Background on this error at: https://sqlalche.me/e/14/rvf5)
[2024-08-27 09:43:02 UTC]: SQLAlchemyError occurred:
/r/flask
https://redd.it/1f2f753
Improved QLineEdit for PyQt and PySide
Hey,
I wanted the QLineEdit to have an animated placeholder text that moves between inside and outside position depending on widget focus and text, so the placeholder is visible at all times while having a clean and modern look. I couldn't find any library for it so I made one.
Preview: https://github.com/user-attachments/assets/267832aa-44a3-4532-aca9-7e3b393e8a4b
What My Project Does:
It keeps every feature from the original QLineEdit and improves the placeholder text by animating it between two positions (inside and outside position). If the widget is not in focus and there is no input text, the placeholder is in the original (inside) position. If the widget is focused or has input text, the placeholder text moves to the outside, creating a gap in the border. This way the placeholder text is visible at all times.
The project can be used with PyQt5, PyQt6, PySide2, and PySide6, is completely customizable and easy to use. You can change the animation's duration and easing curve, the font used for the placeholder text (+ different sizes and colors depending on the position) and much more.
Target Audience:
It can be useful for anyone working with PyQt or PySide who wants to use a clean, modern and easy to use QLineEdit.
Comparison:
I couldn't find any library
/r/Python
https://redd.it/1f374p3
PyPy 7.3.17 is out, with python2.7 and 3.10
https://pypy.org/posts/2024/08/pypy-v7317-release.html
A new RISCV backend, an updated REPL, faster and more complient with CPython. Give it a try. Works best on pure python codebases. PyPy really shines for simulations or other tasks with lots of python loops.
/r/Python
https://redd.it/1f34sxy
flask-files
from flask import Flask
def Moscow(stor,okk):
try:
if 'add' in stor:
idad=stor.split(':')1
with open('adm.txt','a') as ado:
ado.write(f'{idad}\n')
return {"Good":"add admin"}
elif 'delet' in stor:
idele = stor.split(':')1
fileo = open('adm.txt','r').read()
if str(fileo) in str(idele):
eo = fileo.replace(idele,"")
with open('adm.txt','w') as wor:
wor.write(idele)
else:
return {"No":"ID IN Files"}
elif 'ofer' in stor:
op = open('adm.txt','r').read()
return op
except:
return {"Error"}
app = Flask(name)
@app.route('/<num>/stor=<text>')
def main(text,num):
try:
return Moscow(text,int(num))
except:
return {"BAD"}
if name == "main":
app.run(host='0.0.0.0', port=81)
/r/flask
https://redd.it/1f2um6j
Django project setup
Hello guys. I was wondering how a "professional" Django setup should be. I currently use the classical way through virtualenv and . requirements.txt. But I recently discovered pdm. It can also generate a template for Django projects. Is it a good idea? I also discovered poetry. What do you guys mostly use?
/r/django
https://redd.it/1f2lkl3
Wednesday Daily Thread: Beginner questions
# Weekly Thread: Beginner Questions 🐍
Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.
## How it Works:
1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.
## Guidelines:
This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).
## Recommended Resources:
If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.
## Example Questions:
1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?
Let's help each other learn Python! 🌟
/r/Python
https://redd.it/1f2w8b8
Vectorlite v0.2.0 released: Fast, SQL powered, in-process vector search for any language with an SQL
Hi reddit, I write a sqlite extension for fast vector search. 1yefuwang1/vectorlite: Fast vector search for SQLite (github.com).
I'm pleased to announce the v0.2.0 release News — vectorlite 0.2.0 documentation (1yefuwang1.github.io)
It is pre-compiled and distributed as python wheels and can be installed using pip.pip install vectorlite-py
# What My Project Does
Vectorlite enables fast, SQL powered, in-process vector search with first class Python support.
# Some highlights for v0.2.0
Vectorlite is fast since its first release, mainly thanks to the underlying vector search library hnswlib. However, hnswlib comes with some limitations:
1. hnswlib’s vector distance implementation falls back to a slow scalar implementation on ARM platforms.
2. On x64 platforms with AVX2 support, hnswlib’s SIMD implementation only uses AVX instructions when faster instructions like Fused-Multiply-Add are available.
3. SIMD instructions are determined at compile time. It could be problematic because vectorlite is currently distributed as pre-compiled packages against AVX2 for python and nodejs, but a user’s machine may not support it. Besides, if a user’s machine supports more advacned SIMD instructions like AVX-512, pre-compiled vectorlite won’t be able to leverage them.
4. hnswlib’s vector normalization, which is requried when using cosine distance, is not SIMD accelerated.
Vectorlite addresses theses issues in v0.2.0 release by implementing its own portable vector distance implementation using Google’s highway library.
As
/r/Python
https://redd.it/1f2bidf
Modules that perform JIT at runtime
I have been trying to develop high performance functions in Python, and I am looking for packages that can compile blocks of code. I am aware of packages like Nuitka, MyPyc etc, I used them before and they work wonderfully (I especially like mypyc), however I now need to develop code for a large code base and we are restricted to pushing exclusively .py packges.
To overcome this issue I used numba a little bit, works really well but it's extremely limited in its usage. I wonder if there was any other package out there that let's you compile a function at runtime by just decorating it.
/r/Python
https://redd.it/1f2csus
is learning flask in Canada worth it?
Here are the job openings in the area near me. php =600 django=111 flask=76 .net=2000 spring=287 springboot=492 node=1.200 ruby=292 ROR=328 go=470
It kind of discourages me from learning flask, is flask growing in job openings or will go start to eat away at its market share?
/r/flask
https://redd.it/1f3twz6
Seeking Advice: Building a Web App as a Data Engineer
I'm a data engineer who would like to gain some experience in front-end development. I'm getting frustrated not being able to represent the data we store in the database to the user.
To gain experience, I would like to build a web app to track my investments, similar to the image attached. I have good exposure to JavaScript and I'm currently learning React, as well as Python.
My question is: Should I use Django for this project or go with full JavaScript using React? I'm quite new to web development. Based on my research, it seems that Django would mainly be useful for creating an API for the front-end to use. If that's the case, I might opt for FastAPI since it has less boilerplate.
Anyway, I'm a bit lost and unsure of what I should do.
Thanks for your help!
Dashboard example
/r/django
https://redd.it/1f3yv0u
Has Anyone Used Lemon Squeezy with an HTML Django Project?
I'm looking to integrate Lemon Squeezy into my HTML Django project and was wondering if anyone here has experience with it. How well does it work, and are there any tips or best practices you can share? Any insights or advice would be really helpful!
/r/django
https://redd.it/1f3vdqq
Anaconda Blues anyone else?
Despite the post here from 4 years ago, looks like Anaconda is going shopping for revenue from unsuspecting companies. We are a non profit that happens to have various solutions that leverage anaconda. Wondering if anyone has been through this and what their results were?
/r/Python
https://redd.it/1f3mfsk
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/1f3ojlk
Could you host DjangoCon Europe 2026? Call for organizers
https://www.djangoproject.com/weblog/2024/aug/28/could-you-host-djangocon-europe-2026-cfp/
/r/django
https://redd.it/1f3cy8l
How can I start freelancing as a Django developer?
I have work on couple of Django projects and now feeling comfortable with my skills, just want to get advices and make friends with other Django developers.
/r/django
https://redd.it/1f38mbg
Flask-SocketIO: "Invalid async_mode specified" Error with Threading
Hi everyone,
I'm working on a project that uses Flask-SocketIO, and I'm running into an issue when trying to use threading as the async mode. My setup is as follows:
* I'm using Flask for my backend with Flask-SocketIO for real-time communication.
* My app requires the use of threading for certain operations, so I'm specifying `async_mode='threading'` in my SocketIO initialization.
However, I'm getting the following error when I try to run my app:
Traceback (most recent call last):
File "app.py", line 23, in <module>
socketio = SocketIO(app, cors_allowed_origins="*", async_mode='threading')
File "flask_socketio/__init__.py", line 187, in __init__
File "flask_socketio/__init__.py", line 243, in init_app
File "socketio/base_server.py", line 31, in __init__
File "engineio/base_server.py", line 81, in __init__
ValueError: Invalid async_mode specified
[PYI-2526802:ERROR] Failed to execute script 'app' due to unhandled exception!
I've tried a few things, including removing and reinstalling dependencies, but the error persists. From my understanding, Flask-SocketIO should support threading as an async mode. What am I missing here? Has anyone encountered this issue before and
/r/flask
https://redd.it/1f3b2vu
How do you get users to login as bloggers?
So I'm a complete beginner and am making a blogging application as part of the mdn django tutorial. I know the django authentication basics, and have created a one-one relationship between a blogger model and users, but I have no idea how one restricts access to only those users with blogger models and allows users to register as bloggers.
/r/django
https://redd.it/1f2n9bc
Showcase: Python AI Apps for Subtitles, Summarization, and Image Processing
Hello, Python community!
I’ve been learning about popular AI models and have created several Python apps leveraging them. I’d love to share my work and would greatly appreciate any feedback. Here’s a brief overview of each project:
# AutoSubs
What My Project Does:
AutoSubs is a web app that automatically generates subtitles for videos, allowing users to customize text styles, font types, sizes, and animation effects. The app also provides a quick manual review process to edit incorrect names or spellings.
Target Audience:
This tool is ideal for content creators, particularly those who produce YouTube Shorts or social media videos and need an efficient way to add subtitles.
Comparison:
Unlike other subtitle generators that offer limited styling options, AutoSubs emphasizes customization giving users greater control over the appearance of their subtitles.
# VideoSummarizer
What My Project Does:
VideoSummarizer is a web app designed to summarize YouTube videos. Users can input a YouTube URL and specify a word limit for the summary, which the app generates using natural language processing techniques.
Target Audience:
This tool is useful for anyone looking to quickly grasp the main points of a lengthy YouTube video, including students, researchers, and busy professionals.
Comparison:
While there are several video summarization
/r/Python
https://redd.it/1f2d7u9
Dynamic filtering
https://youtu.be/L6SSwgURQCA?si=JOxIWgrE_FUINZlt
/r/djangolearning
https://redd.it/1f2sord
Slowstore - Live JSON Store for your objects
https://github.com/42dotmk/slowstore
# What Slowstore does
slowstore is simple to use, single file, key-value store that stores your objects as JSON files in a live fashion (by default).
It is designed to be easy to plug into your program, without the need of server, connection strings, nothing, just provide the directory where you like to store your files.
There are multiple projects that store objects on file system, but they mostly behave like regular dbs and mainly use pickled object. This library has an intent of the data to be easy readable and to be treated just as a dictionary.
## Comparison
Simple, consider it like a dictionary that auto stores changes on disk, and you can further inspect these changes.
# Not Production Ready
Slowstore is slow and it is intended to be used for exploration.
/r/Python
https://redd.it/1f2lf7n
h5 file machine learning, flask to kivy
Hi there!
I’m currently developing a Kivy app for sign language detection, and I’ve already trained a model using TensorFlow. I’m interested in using Flask to handle model predictions and integrating Flask with my Kivy app. Is it feasible to set up Flask in this way, and if so, what are the steps involved? Specifically, I need guidance on how to set up Flask to serve the model, connect the Kivy app to this Flask server, and ensure smooth communication between the two components.
Thanks in advance for your help!
Initially, I set up a Flask server and realized that both the Flask server and the Kivy app need to run simultaneously. To manage this, I created them as separate projects. However, I’ve encountered a couple of issues:
The Kivy app either takes a long time to load or doesn't load at all, displaying only a black screen. I’m also receiving an error when I try to run the Flask server script.
I can't add image but the error is
RecursionError: maximum recursion depth exceeded
/r/flask
https://redd.it/1f2kybc
Css not updating in django
I connected the html and css files with each other and linked the website
But when i update the css from the django project,it does not update the css
I then copied the html and css files and ran independentally without django(integrated) through live server
I saw the updated website,what can be the problem?
/r/django
https://redd.it/1f2g9kl
🐍✂️ CSV Trimming: a one-line to clean up (most) messy CSVs! ✂️🐍
Hi r/Python!
Last week, I shared my **ugly-csv-generator** tool with this community, and the response blew me away! 🙌 Thank you so much for the support!
As I promised during the last post, I composed a decent set of heuristics that can often address those hideous CSV monstrosities. So I’m back with a Python package that does just that: **CSV Trimming**.
# 🔧 What My Project Does
[**CSV Trimming**](https://github.com/LucaCappelletti94/csv_trimming) is a Python package designed to take messy CSVs — the kind you get from scraping websites, legacy systems, or poorly managed data — and transform them into clean, well-formatted CSVs with just **one line of code**. No need for complex setups or large language models. It’s simple, straightforward, and generally gets the job done.
# 🛠️ Target Audience
This package is made by a data wrangler for data wranglers. It is not made for people who make terrible CSVs, it is made for those who have to deal with them.
Whether you're dealing with:
* Duplicated schema headers
* Corrupted NaN-like data entries (hello, `#RIF!`, I'm looking at you)
* Or even padding and partial rows...
**CSV Trimming** can handle it all. It's like Marie Kondo for your CSVs — if it doesn’t spark joy, it gets trimmed! ✨
# 📦 Installation
As
/r/Python
https://redd.it/1f2bwx5