"Вопросы и ответы" Django и Python

13.09.2025
Multiple Data Entry in Django ORM

I have been trying to create a way that my Django database will store data for 7 consecutive days because I want to use it to plot a weekly graph but the problem now is that Django doesn't have a …

13.09.2025
Session.get works locally but not on server/local server

I have this piece of code that works complete fine on a single python script. When I try to test it out on local server it returns a html page saying link is not vaild. (I am expecting a PDF …

13.09.2025
Failed to create subscription: LinkedIn Developer API real-time notification error

I’m working on enabling real-time notifications from LinkedIn. I can successfully retrieve access tokens, but when I try to create a real-time notification subscription, the API returns the following error. Could someone please help me understand what might be causing …

12.09.2025
Does anyone have any idea about in-project PostgreSQL database? [closed]

I have been recently working on a trading project. Now client has a requirement for in-project Postgresql Database. Have anyone worked across this or maybe something similar???

12.09.2025
Building development image with Nodejs and production without NodeJS (with only precompiled files)

I have a Django application, which is using TailwindCSS for styling (using the django-tailwind package). I am developing locally with docker compose and plan to deploy using the same. So I have the following requirements For development: I need …

12.09.2025
Dj-rest-auth + allauth not sending email

Context: I'm setting DRF + dj-rest-auth + allauth + simple-jwt for user authentication. Desired behaviour: Register with no username, only email. Authorize login only if email is verified with a link sent to email. Social login to be added. Problem: …

12.09.2025
Celery task called inside another task always goes to default queue even with queue specified

I’m running Celery with Django and Celery Beat. Celery Beat triggers an outer task every 30 minutes, and inside that task I enqueue another task per item. Both tasks are decorated to use the same custom queue, but the inner …

11.09.2025
Django + SimpleJWT: Access tokens sometimes expire immediately ("credentials not provided") when calling multiple endpoints

I’m building a Vue 3 frontend (deployed on Vercel at example.com) with a Django REST Framework backend (deployed on Railway at api.example.com). Authentication uses JWT access/refresh tokens stored in HttpOnly cookies (access, refresh). Access token lifetime = 30 minutes Refresh …

11.09.2025
"Django: Cannot use ImageField because Pillow is not installed (Python 3.13, Windows)

PS C:\Users\ltaye\ecommerce> python manage.py runserver Watching for file changes with StatReloader Performing system checks... Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Users\ltaye\AppData\Local\Programs\Python\Python313\Lib\threading.py", line 1043, in _bootstrap_inner self.run() ~~~~~~~~^^ File "C:\Users\ltaye\AppData\Local\Programs\Python\Python313\Lib\threading.py", line 994, in run self._target(*self._args, **self._kwargs) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ …

11.09.2025
How to write a documentation for project/django-project?

How do you write documentation for your projects? How to improve readability of documentation? Do you have any tips for writing documentation? Thanks! Im trying to write my first documenation for django API project and I need a help

11.09.2025
IHow do I coonect a webapp to a thermal printer for printing

I built a web app and bought a thermal printer, I geenrate recipt from the web app, but don't know how to send it to the printer to print, also the connection is not stable. which printer is cost …

11.09.2025
Friends, tell me 🙌 I want to clearly understand what a Junior developer in Django should be able to do

Friends, tell me 🙌 I want to clearly understand what a Junior developer in Django should be able to do. And also: what skills are required besides Django to feel confident at the start in Python backend? I would be …

11.09.2025
Ubuntu 22.04 Django cronjob - No MTA installed, discarding output - Error

If I run this source /var/www/django/env/bin/activate && cd /var/www/django/ && python manage.py cron in the cockpit gui terminal (ubuntu-server 22.04) an email is sent. But if I run it as a cronjob, in crontab: * * * * * …

11.09.2025
How to create an update function for a Django AbstractUser

I created signup/login with 'UserCreationForm'. How can I make update possible by using 'UserChangeForm'? models.py from django.contrib.auth.models import AbstractUser # Create your models here. class CustomUser(AbstractUser): pass def __str__(self): return self.username forms.py from django.contrib.auth.forms import UserCreationForm, UserChangeForm from.models import …

10.09.2025
Django ORM gives duplicates in filtered queryset

I have a django app. I use the ORM to run some queries. It appears I have some duplicates in my result. While I can simply add a distinct() I would like to understand what is going on. Here are …

10.09.2025
Architecture Advice for Research Portal (DRF + Next.js)

I’m currently developing a research portal locally on my Mac using Django REST Framework (DRF) for the backend and Next.js for the frontend. We’re now preparing to move the project to a Test server environment. Our university’s IT Services team …

09.09.2025
Why when adding a cron job , it doesn't work?

I do add a cron job and it is shown when using crontab show but the function in python doesn't get executed and I tried to run the function in the python interpreter and it works , so I guess …

09.09.2025
OIDC django-allauth - kid lookup uses x509 instead of jwk when upgraded to 65.11.0?

We recently upgraded to django-allauth[mfa, socialaccount]==65.11.0 where we are using an OIDC-provider that extends OAuth2Client and we discovered that one of our SocialApplication configs that is connected with an Azure app registration stopped working after the bump. Before the version …

09.09.2025
Django App Deploy Error in AWS ECR+EC2 setup

Enter image description here I have installed Docker & AWS CLI on EC2 instance, pull docker image from ECR to EC2, then have run the Django container on EC2 machine. As of now trying to deploy with …

08.09.2025
Как научиться хорошо писать full-stack

Всем привет, я начинающий full-stack разработчик. Я хочу стать Junior разработчиком, но пока знаю только django и самый простой front-end на html и css. Кто самостоятельно обучался, расскажите пожалуйста, что учить, на каких ресурсах и как можно относительно быстро (1 …

08.09.2025
Django, xhtml2pdf cannot add to canvas properties

I'm trying to create some pdf bar charts in my Django project using xhtml2pdf (which I find easier to use than ReportLab and better than Weasyprint). I can use the example given in the xhtml2pdf docs using …

08.09.2025
I restored my DB from a wrong backup file where the table I need didn't exist but I have migrations that create that table

I had a blog_user table in my DB, but accidentally restored a wrong backup.sql file so it disappeared. I don't have blog_user table in DB right now, but I have a migration creating user model. I tried to re-run the …

07.09.2025
How can I redirect to the same page after submitting a form using Django and display the submitted data on that same page?

This is my class based view function Whenever the use finishes to enter the required data and click the submit button. I want the page to reload so user can see the data they have submitted. I don't want to …

07.09.2025
Как реализовать Update для AbstractUser в Django?

В моем приложении реализованы регистрация/вход с помощью наследования UserCreationForm. Как осуществить изменение пользователя, задействовав UserChangeForm? #models.py from django.contrib.auth.models import AbstractUser Create your models here. class CustomUser(AbstractUser): pass def str(self): return self.username #forms.py from django.contrib.auth.forms import UserCreationForm, UserChangeForm …

06.09.2025
How to secure a refresh token in a JWT system when it's sent as an httpOnly cookie

In my React + Django project, I’m currently sending the refresh token as an HttpOnly cookie. The problem with HttpOnly cookies is that they are automatically sent by the browser, which makes them vulnerable to CSRF attacks. To address this, …

06.09.2025
Custom filter for filter_horizontal admin in django

I have the following models where a deck have a many to many relationship with problems and problems can have tags from django.utils import timezone from django.db import models from taggit.models import TaggedItemBase from taggit.managers import TaggableManager # Create your …

05.09.2025
CheckConstraint in Django model not triggering in unittest.TestCase (AssertionError: IntegrityError not raised)

I have a Model class with a series of constraints that I am attempting to test, and I am unable to get these constraints to return an IntegrityError in testing. The class is as follows: from django.db import models from …

05.09.2025
Issue with connecting Mongodb Atlas with Django using Mongoengine

I have created cluster using free tier in Mongodb Atlas and also it connected with my current IP address. When I am running python manage.py runserver it gives me error-ServerSelectionTimeoutError at /. However if I change the IP address to …

05.09.2025
OSError: [WinError 10106] Не удается загрузить или инициализировать нужного поставщика услуг

Такая проблема. Я пишу сайт, который, грубо говоря, по клику кнопки будет запускать бота для Discord. И если я пытаюсь запустить его из браузера, то выскакивает ошибка "OSError: [WinError 10106] Не …

03.09.2025
How to make Django more secure?

Hey folks 👋 I came across this package that helps with Django security, and honestly, I think it’s one of the best ones out there. It feels really comprehensive while still being easy to use — not too complicated, which …

03.09.2025
Best way to use docker with Django. Containerize ?, or all in a container? [closed]

I've read some tutorials about docker and django : some guys "containerize" an existing app already installed locally. and others install Django in a docker-compose and a Dockerfile (using pip for example), with volumes indeed. So "nothing" is installed …

03.09.2025
How can I securely encrypt spatial fields (GeoDjango / PostGIS) in Django?

I’m working on a Django project with GeoDjango models that store user location data (e.g., PointField, LineStringField). Because location data is highly sensitive, I want to ensure it’s secured (?encrypted) at rest in the database. The challenge is that most …

02.09.2025
Framework django

What should a junior know in django? what topics, etc., and what should a Strong Junior know? please write more details if you can give a full list

02.09.2025
Pytest-django database not rolled back with pytest-asyncio

For context, I am trying to test a WebSocket connection made through Django, so I need to set up some async tests with database support. To do so, I have set up pytest-django and I have some trouble understanding …

02.09.2025
Displaying Categories using forloop in Django project not working

I am making an ecommerce website using Django, and for displaying categories as buttons in the navbar, I tried using a forloop, but its not working. {% for category in categorys %} <li class="nav-item"><a class="nav-link" href="#">{{ category.name }}</a></li> {% …

02.09.2025
Docker django + host posfix gives `Bad destination mailbox address: Address not recognized by gateway`

I'm trying to persuade containerized django to send emails using the postfix installation on my host, and I'm told Bad destination mailbox address: Address not recognized by gateway. (For more detail, the django application I'm running is <a href="https://github.com/zulip/docker-zulip" rel="nofollow …

01.09.2025
Nginx: “no ssl_certificate is defined for the listen … ssl directive” on custom port 8001

Sorry if this question was asked before but I tried the suggestions in there and still cannot resolved it. I’m running Django project behind Nginx on my VPS. Main project is at https://myproject.com (port 443) and works …

01.09.2025
How can I resolve this Django TemplateDoesNotExist error?

I'm working through the &quot;Django 5 by Example&quot; textbook, and am nearly finished with chapter 12, however at the very end when the text asks you to runserver and checkout http://127.0.0.1:8000/accounts/login, I get the following error: …

01.09.2025
I have a Django model called DataLog that stores API action logs. I need to delete this automatically after every 60 days

What is the best practice in Django to achieve this? Should I use a management command + cron job, django-crontab, or Celery beat for scheduling the deletion? Is there a way to make this automatic without having to call the …

01.09.2025
Запуск Redis из Docker

Настраиваю celery для Django. Поставил Docker, поставил Redis, как сделать так, чтобы при старте системы поднимался Redis из Docker, чтобы в виртуальном окружении его не поднимать? Или же Docker надо ставить в самом окружении проекта? ОС Centos 10.