311,429 questions
1
vote
0
answers
36
views
Telegram OAuth with django
im trying to integrate telegram oauth into my application, currently it successfully log in in telegram, but django doesnt received any data in callback, I have tryied many methods, but without any ...
-3
votes
0
answers
47
views
Django project assistance [closed]
When I am creating a new Django project on PyCharm and
Choosing to create it in a new enviornment using virtualenv
Inheriting all global site packages and making available to all projects
Choosing ...
Best practices
0
votes
1
replies
37
views
Best practices for structuring Django REST APIs for maintainability and scalability
I am building a Django-based backend for an e-commerce project with multiple models and REST API endpoints.
I want to follow clean architecture and maintainability best practices.
How should I ...
5
votes
1
answer
81
views
Django static files settings
In my app I combine Django and FastAPI.
For test purpose i've created minimal Django project with default settings and minimal FastAPI app.
So, in my settings:
DEBUG = True
STATIC_URL = 'static/'
I ...
0
votes
2
answers
64
views
How do I create a Django ListView with FormMixin?
I have a working ListView with template. I want to filter the list based on the contents of a form, something like:
class SampleListView(FormMixin, ListView):
model = Sample
paginate_by = 15
...
1
vote
0
answers
75
views
For files uploaded via Django, how can I use them with libraries that require a hard file path to the file?
I am currently working on a text extraction component of my Django backend, which intends to extract text from urls (working), pure text (working), and files (.pdf, .doc, .ppt, .md, .txt, .html).
My ...
-3
votes
0
answers
71
views
Should a single API call handle everything to make life of frontend easy, or there be as many apis as needed [closed]
So I face this issue often. Apart from being a backend python dev, I also have to handle a team consisting of frontend guys as well.
We are into SPAs, and a single page of ours sometime contain a lot ...
Advice
3
votes
7
replies
108
views
Is django backend a good choice to learn now?
I have some experience with Python, and I’m interested in backend development.
Is Django still a good choice to learn in the current job market?
I’m particularly interested in its relevance for modern ...
1
vote
1
answer
72
views
DRF unable to find existing model item in API
I am creating an API with Django Rest Framework and I keep encoutering an issue where i am unable to pull a single item from my django model on the browser.
I have two endpoints one that gets the ...
0
votes
1
answer
42
views
Django-axes seems to ignore ipware settings behind Nginx
Edit.: Ok, so this was something rather stupid on my end. I assumed that since the docs said 'Axes makes use of django-ipware package to detect the IP address of the client and uses some conservative ...
1
vote
0
answers
62
views
Django: exception in get_catalog()
I have a limited set of LANGUAGES:
LANGUAGE_CODE='sl' # It's for locals first of all
LANGUAGES=[
('sl', _('Slovene')), # First is default
('en', _('English')),
('it', _('Italian')),
('...
1
vote
1
answer
59
views
Why won't Django render its select widget with this code
I am trying to use Django's default select widget to render an html dropdown and I just can't seem to figure out what I am doing wrong...
here is my models.py
class VehicleYear(TimeStampedModel):
...
Advice
0
votes
5
replies
35
views
How to migrate data for email field
So i have a char field which i was using to store emails. Now there are some rule/validation and processes for email fields like email validation and email normalization etc. I have to add the ...
Advice
0
votes
2
replies
14
views
Disable add, edit and delete views and widgets for a custom Wagtail ViewSet index page
I have this Django model:
class Player(models.Model):
class Meta:
verbose_name = _("Player")
verbose_name_plural = _("Players")
first_name = models....
1
vote
2
answers
101
views
Django archive user if clicked for detail page view an error appears
I have this user model and in admin.py which of course is used by my client as admin page view and recently my client requested that the user/s who has been archived should not show in the active list ...
0
votes
2
answers
60
views
How can I set up a new comment string in PyCharm for fragment of DTL code in .html file?
In PyCharm we have a convinient way to turn off selected part of a code by pressing Ctrl+/. Later we can turn it on back by pressing the same key combination.
However if I am inside the HTML code the ...
-1
votes
1
answer
63
views
Designing a flexible relationships model in Django
I'm designing a small Django app, and writing some code snippets to go with the design. I have some simple models in the design, like Person and Book:
from django.db import models
class Book(models....
2
votes
1
answer
62
views
Mocked Redis counter does not increment between requests for different users
I am testing a Django view that increments recipe view counters using Redis.
The logic is:
each user can increment recipe views only once
different users should increment the counter
Redis is ...
1
vote
1
answer
27
views
Windows Apache two django projects in separated venv
I need to host two separated apps, with separated venv and separated db, reason cut costs. Both of apps have been developed separately, now I have only single server to host them.
core is running on ...
0
votes
0
answers
71
views
PAPERLESS_FILENAME_FORMAT does not modify the files structure into folders
I installed paperless-ngx (with Docker) on a Raspberry Pi5 with Trixies with success.
After, I uploaded a document, I can see a list of files in this location /paperless-ngx/media/documents/originals
-...
1
vote
2
answers
67
views
Django startproject fails after I manually created the project files/folders (name conflict?)
I’m setting up a Django + Channels project and I think I messed up the order.
I ran these commands:
cd ~
mkdir social_mvp
cd social_mvp
mkdir socialsite
mkdir core
mkdir -p core/templates/core
mkdir -...
Best practices
1
vote
1
replies
19
views
Django admin actions not reflecting on user dashboard and admin privileges are limited
I am working on a Django project where actions performed in the Django admin panel (such as approving users, updating statuses, or modifying records) are not reflecting on the users’ dashboard views. ...
0
votes
0
answers
69
views
Why does Celery with Redis backend create hundreds of connections despite max_connections limits
I am using Django + Celery with Redis as both the broker and the result backend. Here is my Celery configuration:
# Celery settings
CELERY_BROKER_URL = 'redis://redis:6379/1'
CELERY_RESULT_BACKEND = '...
Best practices
1
vote
0
replies
28
views
Wagtail CMS: How to get a searchable ForeignKey field in Page editor (instead of huge dropdown)?
I’m using Wagtail 7.1.2 and have a Page model with a ForeignKey to a model that contains a very large number of rows (cities).
Example:
class CityPage(Page):
cityobject = models.ForeignKey(
...
-2
votes
0
answers
51
views
Django Docker production solutions [duplicate]
I created python django apps for family use, e. g. for movies and books. I use a local pc for development and a NAS with docker to use in production. The applications are reachable via traefik, but ...
0
votes
1
answer
103
views
Why do the Centroid function and centroid method return (slightly) different results
I have a GeoDjango (v5.2) model ("Location") with a MultiPolygonField ("coordinates") and use PostGIS (v17-3.5) as database backend. When I annotate a queryset with the multi-...
0
votes
1
answer
58
views
Django sign up page shows alert "Something went wrong, try again" instead of success message
I am working on Django project.
I have a user_signup page where users can create an account.
When I click Create an Account, and when i create it with users informations , instead of showing "...
0
votes
1
answer
47
views
Django SuperUser Not having the one to one relationship with profile form
I wanted to create a edit profile page and along with the usercreationform fields wanted to add extra fields like phone no and data and use a one to one relation with the model having extra infos
...
Best practices
0
votes
7
replies
98
views
Should I use Django Admin in production for a pharmacy website?
I am building my first production ready pharmacy website using Django.
The backend will be used to manage products, inventory, orders, and users.
I am considering using Django’s built-in Admin ...
0
votes
0
answers
77
views
Navbar opacity drops and disappears when clicking links rapidly using HTMX in Django
I am building a Django website where I use HTMX to load partial HTML content when clicking navbar links (instead of full page reloads).
The navbar itself is not supposed to change, only the main ...
1
vote
0
answers
124
views
HTML not executing code from external JavaScript file
I wrote ajax for django to add products to cart, I use internal js which runs but when I put that code in external js file it doesn't work, Although I received the ID and csrf_token.
html
<main ...
3
votes
1
answer
121
views
"django.db.utils.NutSupportedError: extension 'postgis' not available" error being thrown despite having postgis installed in Python virtualenv
I am attempting to migrate model changes I have made to my codebase to a PostgreSQL server (PostgreSQL 18.1 on x86_64-linux, compiled by gcc-11.4.0, 64-bit), but every time I do this error is thrown. ...
Best practices
0
votes
3
replies
67
views
I have 3 different account types in a Django project. Should I use 1 or 3 apps?
I'm new to Django. I've been making a project with 3 types of accounts: Schools, professors and users. But I feel like some things would be too "repetitive" like some model fields and views ...
-7
votes
0
answers
23
views
i cant install taiwind css in my django project [duplicate]
(venv) PS C:\poultry_link\poultrylink> npx tailwind css init
npm error could not determine executable to run
npm error A complete log of this run can be found in: C:\Users\naallah\AppData\Local\npm-...
-4
votes
1
answer
72
views
django model with foreign key onto settings.AUTH_USER_MODEL fails when app is incorporated into other app using postgres [duplicate]
I have a survey app that works fine as a standalone app with no complaints (using sqlite).
But when I incorporate the survey app into another that is using postgres as a database, it fails to run the ...
1
vote
1
answer
94
views
django model with foreign key onto settings.AUTH_USER_MODEL fails when app is incorporated into other app using postgres
I have a survey app that works fine as a standalone app with no complaints (using sqlite).
But when I incorporate the survey app into another that is using postgres as a database, it fails to run the ...
0
votes
0
answers
78
views
Using django-storages S3 implementation for Minio with s3v4 signature
I have "successfully" set up django-storages to work with our self hosted Minio instance.
This is the settings for the setup:
STORAGES = {
"default": {
"BACKEND&...
1
vote
2
answers
68
views
Does a ModelSerializer catch "django.core.exceptions.ValidationError"s and turn them to an HTTP response with a 400 status code?
Let's say this is my model:
from django.core.exceptions import ValidationError
class MyModel(models.Model):
value = models.CharField(max_length=255)
def clean(self):
if self.value == &...
4
votes
0
answers
130
views
Django ManyToMany table missing even though migrations are applied (Docker + Postgres)
Problem
I am working on a Django project using a PostgreSQL container in Docker. I added a ManyToManyField to one of my models. I keep migrations in .gitignore because my local and production ...
0
votes
1
answer
30
views
Does Django inlineformset allow for editing & submitting related model data?
I'm attempting to display a form for a tennis event (location, time/date) and each of its participants (name, status). I was recommended to use an inlineformset, which I assume would allow editing of ...
1
vote
0
answers
89
views
Django ManyToMany self relationship with through model — user_from and user_to reversed behavior
I added following and followers by using intermediate model, it's ok but does not correctly specify objects in the intermediate model. I expect the user who follows must to be in the user_from field ...
0
votes
1
answer
98
views
Django DRF JWT Authentication credentials were not provided on UpdateAPIView even for is_staff user
I'm implementing JWT authentication using Django REST Framework and djangorestframework-simplejwt in my project.
I have an endpoint for updating a category.
What I tried
Verified that the JWT token ...
-1
votes
1
answer
65
views
What does _db used for in a django Model Manager
While trying to create a custom QuerySet and a custom Manager for a django Model I stumbled upon the documentation sections 1 and 2 that use the manager's _db property and i would like to understand ...
0
votes
1
answer
69
views
Gunicorn (Uvicorn Worker) continues processing requests after Heroku 30s timeout
I’m running a Django (ASGI) app Heroku using Gunicorn with the Uvicorn worker to support WebSockets.
Heroku has a hard 30-second request timeout. When a request exceeds 30 seconds, Heroku closes the ...
1
vote
2
answers
57
views
Does using Django model choices for search filters add server load on every page request?
I’m building a Django-based classifieds website.
Previously, my search form populated districts and categories using database queries like:
districts = (
AdPost.objects
.filter(admin_verified=...
0
votes
0
answers
58
views
Change color for StackedInline?
I'd like to change background color for these headers for different color (not white):
Like this:
My models:
from django.core.validators import MinValueValidator, MaxValueValidator
from django.db ...
1
vote
1
answer
37
views
How to do nested inlines in Django?
I have models:
from django.db import models
class Request(models.Model):
class Method(models.TextChoices):
POST = "POST", "POST"
GET = "GET", "...
2
votes
1
answer
52
views
How to make different url aliases work for local django development
I am using django-tenants and created various aliases that all point to localhost.
If the local development server is reachable via http://localhost:8000/ and I can login to the admin as expected.
If ...
2
votes
1
answer
54
views
Django admin update get_queryset only for "change" view
In my django project admin I have an Order model. I display a bunch of information in the change page with the help of custom inlines. As I use a lot of related models, I want to prefetch/select the ...
Advice
0
votes
2
replies
38
views
Why does Django Http404 return a JSON payload while all other Http error responses don't?
Django's http response.py library provides an Http404 class that can be used to raise a "not found" exception which returns a 404 along with the following JSON payload: {"detail":&...