Unable to Login with Flask-WTF and Flask-Login
\---
**Denoscription:**
I'm building a Flask application with user login functionality using Flask-WTF for form handling and Flask-Login for user authentication. However, I am unable to log in successfully. The page does not redirect as expected, and the login validation does not work.
I have implemented CSRF protection, and I believe the issue might be with how the data is being validated or how the routes are configured.
\---
**What I've Tried:**
1. Ensured that I am redirecting using \`url\_for()\` to a valid route.
2. Added \`csrf.init\_app(app)\` in my \`create\_app()\` function.
3. Included \`{{ form.csrf\_token() }}\` in my login form.
4. Verified that my database connection works, and user data is stored correctly.
5. Checked that Flask-Login's \`login\_user()\` function is being called.
\---
**Code Snippets:**
**\_\_init\_\_.py**
**python**
`from flask import Flask`
`from flask_sqlalchemy import SQLAlchemy`
`from flask_migrate import Migrate`
`from flask_bcrypt import Bcrypt`
`from flask_login import LoginManager`
`from flask_wtf.csrf import CSRFProtect`
`db = SQLAlchemy()`
`migrate = Migrate()`
`bcrypt = Bcrypt()`
`login_manager = LoginManager()`
`csrf = CSRFProtect()`
`def create_app():`
`app = Flask(__name__)`
`app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:Root1234!@localhost/school_hub'`
`app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False`
`app.secret_key = 'your-secret-key'`
`db.init_app(app)`
`migrate.init_app(app, db)`
`login_manager.init_app(app)`
`bcrypt.init_app(app)`
`csrf.init_app(app)`
`login_manager.login_view = 'login'`
`from .routes import main as main_blueprint`
`app.register_blueprint(main_blueprint)`
`with app.app_context():`
`db.create_all()`
`return app`
`login_manager.user_loader`
`def load_user(user_id):`
`from .models import User`
`return User.query.get(int(user_id))`
**routes.py**
**python**
`from flask import render_template, request, redirect, url_for, flash`
`from flask_login import login_user`
`from .models import User`
`from .forms import LoginForm`
`app.route("/login", methods=["GET", "POST"])`
`def login():`
`form = LoginForm()`
`if form.validate_on_submit():`
`email = form.email.data`
`password = form.password.data`
`user = User.query.filter_by(email=email).first()`
`if user and user.check_password(password):`
`login_user(user)`
`return redirect(url_for('home'))`
`else:`
`flash("Invalid credentials", "danger")`
`return render_template("login.html",
/r/flask
https://redd.it/1gsm10l
\---
**Denoscription:**
I'm building a Flask application with user login functionality using Flask-WTF for form handling and Flask-Login for user authentication. However, I am unable to log in successfully. The page does not redirect as expected, and the login validation does not work.
I have implemented CSRF protection, and I believe the issue might be with how the data is being validated or how the routes are configured.
\---
**What I've Tried:**
1. Ensured that I am redirecting using \`url\_for()\` to a valid route.
2. Added \`csrf.init\_app(app)\` in my \`create\_app()\` function.
3. Included \`{{ form.csrf\_token() }}\` in my login form.
4. Verified that my database connection works, and user data is stored correctly.
5. Checked that Flask-Login's \`login\_user()\` function is being called.
\---
**Code Snippets:**
**\_\_init\_\_.py**
**python**
`from flask import Flask`
`from flask_sqlalchemy import SQLAlchemy`
`from flask_migrate import Migrate`
`from flask_bcrypt import Bcrypt`
`from flask_login import LoginManager`
`from flask_wtf.csrf import CSRFProtect`
`db = SQLAlchemy()`
`migrate = Migrate()`
`bcrypt = Bcrypt()`
`login_manager = LoginManager()`
`csrf = CSRFProtect()`
`def create_app():`
`app = Flask(__name__)`
`app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:Root1234!@localhost/school_hub'`
`app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False`
`app.secret_key = 'your-secret-key'`
`db.init_app(app)`
`migrate.init_app(app, db)`
`login_manager.init_app(app)`
`bcrypt.init_app(app)`
`csrf.init_app(app)`
`login_manager.login_view = 'login'`
`from .routes import main as main_blueprint`
`app.register_blueprint(main_blueprint)`
`with app.app_context():`
`db.create_all()`
`return app`
`login_manager.user_loader`
`def load_user(user_id):`
`from .models import User`
`return User.query.get(int(user_id))`
**routes.py**
**python**
`from flask import render_template, request, redirect, url_for, flash`
`from flask_login import login_user`
`from .models import User`
`from .forms import LoginForm`
`app.route("/login", methods=["GET", "POST"])`
`def login():`
`form = LoginForm()`
`if form.validate_on_submit():`
`email = form.email.data`
`password = form.password.data`
`user = User.query.filter_by(email=email).first()`
`if user and user.check_password(password):`
`login_user(user)`
`return redirect(url_for('home'))`
`else:`
`flash("Invalid credentials", "danger")`
`return render_template("login.html",
/r/flask
https://redd.it/1gsm10l
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Custom Analytics Libraries
I've made a very basic Django site, I'll deploy it later on but I'm actually having a little of fun making it. I work as an analyst and I've managed to get 4 queries from and display them with chart.js and I'm super happy with how it looks, I'll do some more formatting at a later date but I'd like to keep building this out.
Does anyone else have any experience making their own analytics stuff? What libraries look good for displaying charts and stuff? I realize I'm not reinventing the wheel, we use Looker and Tableau at work but I would like to do something cool.
/r/django
https://redd.it/1gsl3vb
I've made a very basic Django site, I'll deploy it later on but I'm actually having a little of fun making it. I work as an analyst and I've managed to get 4 queries from and display them with chart.js and I'm super happy with how it looks, I'll do some more formatting at a later date but I'd like to keep building this out.
Does anyone else have any experience making their own analytics stuff? What libraries look good for displaying charts and stuff? I realize I'm not reinventing the wheel, we use Looker and Tableau at work but I would like to do something cool.
/r/django
https://redd.it/1gsl3vb
Reddit
From the django community on Reddit
Explore this post and more from the django community
Finally Completed : A Personal Project built over the weekend(s) - Netflix Subnoscript Translator
Motivation : Last week, I posted about my project, Netfly: The Netflix Translator, here on r/python. I initially built it to solve a problem I ran into while traveling. Let me explain :
On a flight from New Delhi to Tokyo, I started watching an anime movie, The Concierge. The in-flight entertainment had English subnoscripts, and I was hooked, but I couldn’t finish it. Later, I found the movie on Netflix Japan, but it was only available with Japanese subnoscripts.
Here’s the problem: I don’t know enough Japanese (Nihongo wa sukoshi desu) to follow along, so I decided to build something that could fetch those Japanese subnoscripts, translate them into English, and overlay the translation on the video while retaining the Japanese subnoscripts which would give me better context.
What started as a personal project quickly became an obsession.
What does the Project Do ? : The primary goal of this project is simple: convert Japanese subnoscripts on Netflix into English subnoscripts in an automated way. This is particularly useful when English subnoscripts aren’t available for a noscript.
The Evolution of this Project / High Level Tech Solution : This is not the first iteration of Netfly. It has gone through two major updates based
/r/Python
https://redd.it/1gsm1kp
Motivation : Last week, I posted about my project, Netfly: The Netflix Translator, here on r/python. I initially built it to solve a problem I ran into while traveling. Let me explain :
On a flight from New Delhi to Tokyo, I started watching an anime movie, The Concierge. The in-flight entertainment had English subnoscripts, and I was hooked, but I couldn’t finish it. Later, I found the movie on Netflix Japan, but it was only available with Japanese subnoscripts.
Here’s the problem: I don’t know enough Japanese (Nihongo wa sukoshi desu) to follow along, so I decided to build something that could fetch those Japanese subnoscripts, translate them into English, and overlay the translation on the video while retaining the Japanese subnoscripts which would give me better context.
What started as a personal project quickly became an obsession.
What does the Project Do ? : The primary goal of this project is simple: convert Japanese subnoscripts on Netflix into English subnoscripts in an automated way. This is particularly useful when English subnoscripts aren’t available for a noscript.
The Evolution of this Project / High Level Tech Solution : This is not the first iteration of Netfly. It has gone through two major updates based
/r/Python
https://redd.it/1gsm1kp
Reddit
From the Python community on Reddit: Finally Completed : A Personal Project built over the weekend(s) - Netflix Subnoscript Translator
Explore this post and more from the Python community
Django Challenges
I want to improve my coding skills on django and understand concepts better. Are they any django challenges monthly and weekly??
/r/djangolearning
https://redd.it/1gsjxpx
I want to improve my coding skills on django and understand concepts better. Are they any django challenges monthly and weekly??
/r/djangolearning
https://redd.it/1gsjxpx
Reddit
From the djangolearning community on Reddit
Explore this post and more from the djangolearning community
My site passes 45 security checks..
I made an ecommerce site with django, I am not that expert on security.. I try to follow what django provides for that, and I do drf’s is_valid method to incoming data..
There are about 150 apis and 50 frontend pages. I asked the cyber security agency that the government operates..
They check about 45 cyber attacks include OWASP top10.. it took about 2weeks and I got the report.. I was very nervous because I spent 2years to build the site and if it had many vernerabilities.. I wouldnt know how to fix..
Wow.. no single vernerabilies found, thanks to django.. I cant believe that django is that solid and secure..
/r/django
https://redd.it/1gsq92b
I made an ecommerce site with django, I am not that expert on security.. I try to follow what django provides for that, and I do drf’s is_valid method to incoming data..
There are about 150 apis and 50 frontend pages. I asked the cyber security agency that the government operates..
They check about 45 cyber attacks include OWASP top10.. it took about 2weeks and I got the report.. I was very nervous because I spent 2years to build the site and if it had many vernerabilities.. I wouldnt know how to fix..
Wow.. no single vernerabilies found, thanks to django.. I cant believe that django is that solid and secure..
/r/django
https://redd.it/1gsq92b
Reddit
From the django community on Reddit
Explore this post and more from the django community
Write good tests
I just published an article outlining what I think good tests in Python are often missing. It's not intended to flesh out on any of the topics, and is frugal on the details where I think they are better explained other place. Rather it's intended to inspire your style guides and convention documents. These are an assembly of issues that's been up for discussion in various places I've worked, and my opinionated take on them.
So please, write good tests.
https://www.agest.am/write-good-python-tests
/r/Python
https://redd.it/1gspitz
I just published an article outlining what I think good tests in Python are often missing. It's not intended to flesh out on any of the topics, and is frugal on the details where I think they are better explained other place. Rather it's intended to inspire your style guides and convention documents. These are an assembly of issues that's been up for discussion in various places I've worked, and my opinionated take on them.
So please, write good tests.
https://www.agest.am/write-good-python-tests
/r/Python
https://redd.it/1gspitz
www.agest.am
Write good Python tests | agest.am
Python testing practices aimed at producing maintainable code bases with test suites that are understandable, and brings confidence to the correctness of the program, and that in general optimizes for smooth future interactions with your code.
What is the industry standard for Django project structure?
tldr: I have seen many posts on what the "best" Django project structure is. What is standard in the industry and why?
I'm learning the Django framework and I'm trying to investigate and understand the project folder structure and reasoning behind it. I'm aware of clean architecture and vertical slice architecture, so my first instinct is to adapt to something like that. I came across https://www.jamesbeith.co.uk/blog/how-to-structure-django-projects/ , which seems in line with what I'm looking for, though I'm not sure how often it is used in practice.
From Googling, it seems that a typical structure is the following, https://github.com/HackSoftware/Django-Styleguide-Example/ , where basically every module is a Django app (e.g. api, core, emails, users, etc are apps). To me, this seems to have some "disadvantages".
1. Models and migrations are scattered throughout the project, as opposed to being in 2 folders.
2. Excess boilerplate
3. Not everything needs to be a Django app (e.g. utility functions which don't reference Django at all).
From my current understanding, it seems like the only reasons we need Django apps are the migrations folder and models.py, as well a way to provide url patterns (e.g. urls.py) and views (e.g. views.py) so that the include function can pick them up. Unless I'm
/r/django
https://redd.it/1gsuhmj
tldr: I have seen many posts on what the "best" Django project structure is. What is standard in the industry and why?
I'm learning the Django framework and I'm trying to investigate and understand the project folder structure and reasoning behind it. I'm aware of clean architecture and vertical slice architecture, so my first instinct is to adapt to something like that. I came across https://www.jamesbeith.co.uk/blog/how-to-structure-django-projects/ , which seems in line with what I'm looking for, though I'm not sure how often it is used in practice.
From Googling, it seems that a typical structure is the following, https://github.com/HackSoftware/Django-Styleguide-Example/ , where basically every module is a Django app (e.g. api, core, emails, users, etc are apps). To me, this seems to have some "disadvantages".
1. Models and migrations are scattered throughout the project, as opposed to being in 2 folders.
2. Excess boilerplate
3. Not everything needs to be a Django app (e.g. utility functions which don't reference Django at all).
From my current understanding, it seems like the only reasons we need Django apps are the migrations folder and models.py, as well a way to provide url patterns (e.g. urls.py) and views (e.g. views.py) so that the include function can pick them up. Unless I'm
/r/django
https://redd.it/1gsuhmj
James Beith
How to structure Django projects
Here are some notes on how to structure a Django project. It breaks away from structuring a project around Django “apps” and instead uses a clear separation between three core layers (data, domain, and interfaces). Let’s use the following example, an e-commerce…
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 noscript 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/1gt0n9f
# 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 noscript 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/1gt0n9f
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
How to Build No-Code Modal Components for Wagtail CMS Content Editors | A step by step guide
https://blog.adonissimo.com/how-to-build-no-code-modal-components-for-wagtail-cms-content-editors
/r/django
https://redd.it/1gt24og
https://blog.adonissimo.com/how-to-build-no-code-modal-components-for-wagtail-cms-content-editors
/r/django
https://redd.it/1gt24og
adonis simo's notes
How to Build No-Code Modal Components for Wagtail | Step-by-Step Guide
Learn how to create customizable modal components in Wagtail CMS that content editors can manage without code.
Please help! Either getting 404 website error or an error with .flaskenv.
https://redd.it/1gsd73p
@pythondaily
https://redd.it/1gsd73p
@pythondaily
Reddit
From the flask community on Reddit: Please help! Either getting 404 website error or an error with .flaskenv.
Explore this post and more from the flask community
React-Django Deployment
I have been working on Ngnix and Gunicorn the whole day and no luck. It's crazy. Both backend and frontend have deployed successfully but while trying to access the backend from the browser I get no response. I need help with configuration. Any leads?
/r/djangolearning
https://redd.it/1gsv99j
I have been working on Ngnix and Gunicorn the whole day and no luck. It's crazy. Both backend and frontend have deployed successfully but while trying to access the backend from the browser I get no response. I need help with configuration. Any leads?
/r/djangolearning
https://redd.it/1gsv99j
Reddit
From the djangolearning community on Reddit
Explore this post and more from the djangolearning community
Write any Python noscript in 30 characters (plus an ungodly amount of whitespace)
Hey all!
My friend challenged me to find the shortest solution to a certain Leetcode-style problem in Python. They were generous enough to let me use whitespace for free, so that the code stays readable.
# What My Project Does
I like abusing rules, so I made a tool to encode any Python noscript in just 30 bytes, plus some a lot of whitespace.
This result is somewhat harder to achieve than it looks like at first, so you might want to check out a post I wrote about it. Alternatively, jump straight to the code if that's more of your thing: GitHub.
# Target Audience
This is a toy project, nothing serious, but it was fun for me to work on. I hope you find it entertaining too!
# Comparison
This is honestly the first time I've seen anyone do this with a specific goal of reducing the number of non-whitespace characters at any cost, so this might as well be a unique project.
As a honorary mention, though, it builds on another project I think deserves recognition: PyFuck. It's JSFuck for Python, using 8 different characters to encode any (short enough) Python program.
/r/Python
https://redd.it/1gsyls8
Hey all!
My friend challenged me to find the shortest solution to a certain Leetcode-style problem in Python. They were generous enough to let me use whitespace for free, so that the code stays readable.
# What My Project Does
I like abusing rules, so I made a tool to encode any Python noscript in just 30 bytes, plus some a lot of whitespace.
This result is somewhat harder to achieve than it looks like at first, so you might want to check out a post I wrote about it. Alternatively, jump straight to the code if that's more of your thing: GitHub.
# Target Audience
This is a toy project, nothing serious, but it was fun for me to work on. I hope you find it entertaining too!
# Comparison
This is honestly the first time I've seen anyone do this with a specific goal of reducing the number of non-whitespace characters at any cost, so this might as well be a unique project.
As a honorary mention, though, it builds on another project I think deserves recognition: PyFuck. It's JSFuck for Python, using 8 different characters to encode any (short enough) Python program.
/r/Python
https://redd.it/1gsyls8
purplesyringa's blog
Any Python program fits in 24 characters*
* If you don’t take whitespace into account.
My friend challenged me to find the shortest solution to a certain Leetcode-style problem in Python. They were generous enough to let me use whitespace for free, so that the code stays readable. So that’s exactly…
My friend challenged me to find the shortest solution to a certain Leetcode-style problem in Python. They were generous enough to let me use whitespace for free, so that the code stays readable. So that’s exactly…
AnyModal: A Python Framework for Multimodal LLMs
[AnyModal](https://github.com/ritabratamaiti/AnyModal) is a modular and extensible framework for integrating diverse input modalities (e.g., images, audio) into large language models (LLMs). It enables seamless tokenization, encoding, and language generation using pre-trained models for various modalities.
### Why I Built AnyModal
I created AnyModal to address a gap in existing resources for designing vision-language models (VLMs) or other multimodal LLMs. While there are excellent tools for specific tasks, there wasn’t a cohesive framework for easily combining different input types with LLMs. AnyModal aims to fill that gap by simplifying the process of adding new input processors and tokenizers while leveraging the strengths of pre-trained language models.
### Features
- **Modular Design**: Plug and play with different modalities like vision, audio, or custom data types.
- **Ease of Use**: Minimal setup—just implement your modality-specific tokenization and pass it to the framework.
- **Extensibility**: Add support for new modalities with only a few lines of code.
### Example Usage
```python
from transformers import ViTImageProcessor, ViTForImageClassification
from anymodal import MultiModalModel
from vision import VisionEncoder, Projector
# Load vision processor and model
processor = ViTImageProcessor.from_pretrained('google/vit-base-patch16-224')
vision_model = ViTForImageClassification.from_pretrained('google/vit-base-patch16-224')
hidden_size = vision_model.config.hidden_size
# Initialize vision encoder and projector
vision_encoder = VisionEncoder(vision_model)
vision_tokenizer = Projector(in_features=hidden_size, out_features=768)
# Load LLM components
from transformers import AutoTokenizer, AutoModelForCausalLM
llm_tokenizer = AutoTokenizer.from_pretrained("gpt2")
llm_model = AutoModelForCausalLM.from_pretrained("gpt2")
# Initialize AnyModal
multimodal_model = MultiModalModel(
input_processor=None,
/r/Python
https://redd.it/1gtbrzb
[AnyModal](https://github.com/ritabratamaiti/AnyModal) is a modular and extensible framework for integrating diverse input modalities (e.g., images, audio) into large language models (LLMs). It enables seamless tokenization, encoding, and language generation using pre-trained models for various modalities.
### Why I Built AnyModal
I created AnyModal to address a gap in existing resources for designing vision-language models (VLMs) or other multimodal LLMs. While there are excellent tools for specific tasks, there wasn’t a cohesive framework for easily combining different input types with LLMs. AnyModal aims to fill that gap by simplifying the process of adding new input processors and tokenizers while leveraging the strengths of pre-trained language models.
### Features
- **Modular Design**: Plug and play with different modalities like vision, audio, or custom data types.
- **Ease of Use**: Minimal setup—just implement your modality-specific tokenization and pass it to the framework.
- **Extensibility**: Add support for new modalities with only a few lines of code.
### Example Usage
```python
from transformers import ViTImageProcessor, ViTForImageClassification
from anymodal import MultiModalModel
from vision import VisionEncoder, Projector
# Load vision processor and model
processor = ViTImageProcessor.from_pretrained('google/vit-base-patch16-224')
vision_model = ViTForImageClassification.from_pretrained('google/vit-base-patch16-224')
hidden_size = vision_model.config.hidden_size
# Initialize vision encoder and projector
vision_encoder = VisionEncoder(vision_model)
vision_tokenizer = Projector(in_features=hidden_size, out_features=768)
# Load LLM components
from transformers import AutoTokenizer, AutoModelForCausalLM
llm_tokenizer = AutoTokenizer.from_pretrained("gpt2")
llm_model = AutoModelForCausalLM.from_pretrained("gpt2")
# Initialize AnyModal
multimodal_model = MultiModalModel(
input_processor=None,
/r/Python
https://redd.it/1gtbrzb
GitHub
GitHub - ritabratamaiti/AnyModal: AnyModal is a Flexible Multimodal Language Model Framework for PyTorch
AnyModal is a Flexible Multimodal Language Model Framework for PyTorch - ritabratamaiti/AnyModal
Why is my django-cte manager a lot faster than a custom QuerySet?
I have this Car model that I want to sort by speed. I implemented two different ways to do these: one is by using a custom queryset and the other is using an external package using django-cte (see below). For some reason, the CTE implementation is alot faster even though the queries are the same (same limit, same offset, same filters, ...). And I'm talking tens of magnitude better, since for 1 million records the custom queryset runs for approx 21s while the CTE one is running for 2s only. Why is this happening? Is it because the custom queryset is sorting it first then does the necessary filters?
```
from django.db import models
from django.utils.translation import gettext_lazy as _
from django_cte import CTEManager, With
class CarCTEManager(CTEManager):
def sort_speed(self):
cte = With(
Car.objects.annotate(
rank=models.Window(
expression=models.functions.Rank(),
/r/django
https://redd.it/1gt9q67
I have this Car model that I want to sort by speed. I implemented two different ways to do these: one is by using a custom queryset and the other is using an external package using django-cte (see below). For some reason, the CTE implementation is alot faster even though the queries are the same (same limit, same offset, same filters, ...). And I'm talking tens of magnitude better, since for 1 million records the custom queryset runs for approx 21s while the CTE one is running for 2s only. Why is this happening? Is it because the custom queryset is sorting it first then does the necessary filters?
```
from django.db import models
from django.utils.translation import gettext_lazy as _
from django_cte import CTEManager, With
class CarCTEManager(CTEManager):
def sort_speed(self):
cte = With(
Car.objects.annotate(
rank=models.Window(
expression=models.functions.Rank(),
/r/django
https://redd.it/1gt9q67
Reddit
From the django community on Reddit
Explore this post and more from the django community
Deply: keep your python architecture clean
Hello everyone,
My name is Archil. I'm a Python/PHP developer originally from Ukraine, now living in Wrocław, Poland. I've been working on a tool called [Deply](https://github.com/Vashkatsi/deply), and I'd love to get your feedback and thoughts on it.
# What My Project Does
**Deply** is a standalone Python tool designed to enforce architectural patterns and dependencies in large Python projects. Deply analyzes your code structure and dependencies to ensure that architectural rules are followed. This promotes cleaner, more maintainable, and modular codebases.
**Key Features:**
* **Layer-Based Analysis**: Define custom layers (e.g., models, views, services) and restrict their dependencies.
* **Dynamic Configuration**: Easily configure collectors for each layer using file patterns and class inheritance.
* **CI Integration**: Integrate Deply into your Continuous Integration pipeline to automatically detect and prevent architecture violations before they reach production.
# Target Audience
* **Who It's For**: Developers and teams working on medium to large Python projects who want to maintain a clean architecture.
* **Intended Use**: Ideal for production environments where enforcing module boundaries is critical, as well as educational purposes to teach best practices.
# Use Cases
* **Continuous Integration**: Add Deply to your CI/CD pipeline to catch architectural violations early in the development process.
* **Refactoring**: Use Deply to understand existing dependencies in your codebase, making large-scale
/r/Python
https://redd.it/1gthdpy
Hello everyone,
My name is Archil. I'm a Python/PHP developer originally from Ukraine, now living in Wrocław, Poland. I've been working on a tool called [Deply](https://github.com/Vashkatsi/deply), and I'd love to get your feedback and thoughts on it.
# What My Project Does
**Deply** is a standalone Python tool designed to enforce architectural patterns and dependencies in large Python projects. Deply analyzes your code structure and dependencies to ensure that architectural rules are followed. This promotes cleaner, more maintainable, and modular codebases.
**Key Features:**
* **Layer-Based Analysis**: Define custom layers (e.g., models, views, services) and restrict their dependencies.
* **Dynamic Configuration**: Easily configure collectors for each layer using file patterns and class inheritance.
* **CI Integration**: Integrate Deply into your Continuous Integration pipeline to automatically detect and prevent architecture violations before they reach production.
# Target Audience
* **Who It's For**: Developers and teams working on medium to large Python projects who want to maintain a clean architecture.
* **Intended Use**: Ideal for production environments where enforcing module boundaries is critical, as well as educational purposes to teach best practices.
# Use Cases
* **Continuous Integration**: Add Deply to your CI/CD pipeline to catch architectural violations early in the development process.
* **Refactoring**: Use Deply to understand existing dependencies in your codebase, making large-scale
/r/Python
https://redd.it/1gthdpy
GitHub
GitHub - Vashkatsi/deply: Keep your python architecture clean.
Keep your python architecture clean. Contribute to Vashkatsi/deply development by creating an account on GitHub.