Questions tagged [django]
Django is an open-source server-side web application framework written in Python. It is designed to reduce the effort required to create complex data-driven websites and web applications, with a special focus on less code, no-redundancy and being more explicit than implicit.
django
312,579
questions
0
votes
0
answers
11
views
Dependency Error in Railway even though the dependency is actually not listed
enter image description here
I'm getting this error even though there is no "zee5" dependency in my django app. I checked this through
How should I fix this issue?
pip list
I checked the ...
0
votes
1
answer
18
views
Getting 401 Unauthorized Error on Login in React Web App
Whenever I click the login button of my web page built with vite-react(frontend:5173), express(server 5000, to handle cookies httpOnly) and Django(backend:8080). the console logs an error of (GET http:...
1
vote
0
answers
14
views
Error 404 redirect not working in Django and static files not showing in edge
I am developing a single page webapp where I am trying to configure the error page if page not found so I have added proper settings but still my redirect not working on error page.
Here is my ...
0
votes
0
answers
8
views
Djoser permissions
How can I configure Djoser so that it does not attempt to provide profile data for anonymous users?
My settings:
DJOSER = {
"LOGIN_FIELD": "email",
"HIDE_USERS": ...
-1
votes
1
answer
26
views
Django Website not accessible on some browsers
I have a web app built with django that is hosted online on a subdomain. It was working fine until a few days ago when certain users started getting errors trying to access it where it would say ...
0
votes
0
answers
49
views
Understanding sync_to_async method in Django?
I have never worked with asyncio and/or asynchronous methods with django and am having a little difficulty understanding.
I am trying to convert a synchronous utility function (create_email_record) ...
0
votes
1
answer
17
views
Django - select onchange event not working anymore if using jquery-editable-select
I'm using a select item from a django model with a onchange event to trig a JS script :
forms.py
class forms_bdc(forms.ModelForm):
[...]
bdc_description_1 = forms.ModelChoiceField(queryset=...
-2
votes
0
answers
30
views
Python Django Web App Returning 404 Error for the GET request
I have created a basic web app using Python Django. Currently only one API is implemented i.e. User/GetUserName.aspx which return as simple "Hello" message. The web service is running on ...
-1
votes
0
answers
15
views
Django hosted on Render - Media Files/template vars
I've got a Django app that stores its static and media files in an AWS S3 bucket. Retrieval, usage and storage of these files work fine locally. The issue is, when accessing through the live site ...
1
vote
1
answer
21
views
Unable to enter json in django admin
In my model I have the following field -
data_fields = ArrayField(models.JSONField(null=True, blank=True), blank=True, null=True)
In order to test this out, I entered the following in the data_field ...
0
votes
0
answers
8
views
Managing Inconsistent Model Attribute State on WebSocket Reconnect (Django Channels)
import json, jwt, uuid, random
from channels.generic.websocket import AsyncWebsocketConsumer
from django.conf import settings
from asgiref.sync import sync_to_async
from .models import GameRoom
class ...
0
votes
0
answers
13
views
Django sessionid cookies disappearing upon refresh
I am using a Django DRF backend with SessionAuthentication and a NextJS frontend. They are hosted on different ports. I am trying to use the django login function to automatically log the user in when ...
0
votes
0
answers
17
views
Error While Running dajngo project server through WSL
I am using Postgres as my db for this project.
My project directory is in my windows system.
Virtual environment was created in both windows and wsl (ubuntu) with all the dependencies.
Postgres-16 and ...
-2
votes
1
answer
15
views
403 error in django and enginx static files [closed]
I run the Django app with gunicorn and nginx on a virtual server. But it gives a 403 error for loading static files
this is nginx config:
enter image description here
this is nginx sites-evailabel:
...
0
votes
0
answers
18
views
InvalidCursorName in Django project [closed]
This is my models.py file:
class TaskDetails(models.Model):
TASK_CHOICES = [
('ploughing', 'Ploughing'),
('sowing', 'Sowing'),
('watering', 'Watering'),
('...
0
votes
1
answer
19
views
how to autogenerate context for APIView methods
I need to write my own APIView class which overrides drf's APIView and it will have autogenerated self.context which I can pass into serializer.
For example
class SomeView(APIView):
def post(self, ...
0
votes
0
answers
11
views
Python Django : ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2427)
Traceback (most recent call last):
File "C:\Program Files\Python311\Lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\ADMİN\AppData\Roaming\Python\...
0
votes
0
answers
25
views
Reverse for 'post_detail' with arguments ... not found
i'm having NoReverseMatch error message. already spend hours everything looks ok to me but couldn't figure it out. I would appreciate any help. thanks
views.py
from django.http import Http404
from ...
0
votes
0
answers
15
views
Django form.cleaned_data switches values between Form class choice fields
I am trying to filter a model's objects dynamically depending on what the user selects in a form. The form allows selecting from two dropdown lists. Selecting from either dropdown is optional. If the ...
0
votes
0
answers
12
views
I want to configure my django admin as subdomain on nginx
I've configured Nginx to proxy requests for admin.myproject.com to my Django application running on port 8000. However, when accessing admin.myproject.com, it redirects to admin.myproject.com/admin ...
0
votes
1
answer
15
views
django DATETIME_INPUT_FORMATS not working after upgrading to django 5.0
I just upgraded to django 5.0, and the DATETIME_INPUT_FORMATS is no longer working in the settings.py file. It is not accepting DOY (%j) dates like it did before. I have looked at similar questions on ...
-1
votes
0
answers
23
views
why can not post this data in rest_framework django? [closed]
I'm encountering an error when testing this code with Postman. Can you help me identify the cause? "AssertionError at /POST_Create_NewInvoiceBuy/
("Creating a ModelSerializer without either ...
0
votes
0
answers
15
views
Manager isn't available; 'auth.User' has been swapped for 'main.User'
I had to recreate User model. I have added custom phone and zip_code fields to the model. But I am encountering Manager isn't available; 'auth.User' has been swapped for 'main.User' error.
This is my ...
0
votes
0
answers
13
views
Use raw sql in django model default
I'm trying to set the default of a model column to the postgres function
currval(pg_get_serial_sequence('public.user','id'))
like recommended in a posgres related stackoverflow answer.
I tried
from ...
0
votes
2
answers
27
views
Can a Django management command tell when the server is running?
I have a management command that does some manipulation of the database so I don't want it running while the server is up. Is there a way to tell if the server is running from a management command
1
vote
0
answers
13
views
Authenticating user on React frontend, against Django backend user groups using JWT
Having issues authenticating a user from React frontend, to Django backend using JWT Tokens.
I have a Django instance with check_auth view in views.py:
@csrf_exempt
@login_required
def check_auth(...
0
votes
0
answers
15
views
Django - Filtering on annotated count field returns unexpected values
I have a function that filters a Django queryset on the number of linked objects. Used inside a graphene-django project, it allows me to dynamically create filter fields for a bunch of objects without ...
1
vote
1
answer
22
views
How do I configure label-studio to use a different root URL?
I want to serve labelstudio under a different path in stead of the root URL.
I am using an AWS Load Balancer that has several other services and want to use /labelstudio/ as the root for label studio.
...
0
votes
0
answers
17
views
Django - Admin – Inline. Add a default value
There is a structure
class StatPersonalForm(forms.ModelForm):
class Meta:
model = StatPersonal
fields = "__all__"
pass
class StatPersonalInline(admin.TabularInline):
...
0
votes
0
answers
20
views
Spotify API - I am getting 403 (Forbidden) when pausing a track
I am working on Spotify API integration using Django + React stack. When pausing a track, I am getting this error:
"PUT /spotify/pause-song HTTP/1.1" 403 2
Fetching track information is ...
0
votes
0
answers
9
views
How to sync smtp mailbox to local inbox
I am creating an email campaign system with several connected accounts. I periodically fetch emails from SMTP through IMAP and store them locally in my inbox. How can I sync inbox with the SMTP server,...
0
votes
0
answers
13
views
AWS Gunicorn configuration Amazon Linux Work not properly
enter image description here
This image is show problem.
When i run gunicorn service with this configuration.
GNU nano 5.8 pair....
1
vote
2
answers
24
views
Django ORM model 'save' method and race condition / ACID Isolation
if we examine the following code:
class SomeModel(models.Model):
...
def save(self, *args, **kwargs):
self.validate_unique()
super().save()
def validate_unique(self, *args,...
0
votes
0
answers
63
views
How do i enable user to login with new password after reseting it
I am trying to create a password reset system in django. So the issue is that I'm trying to login my user after resetting the password but the system throws an Invalid credentials error.
I used a ...
-1
votes
0
answers
22
views
HTML coun'd locate my image when I put the folder into my django app [duplicate]
Before I put the html file inside the template folder follow along with my dijango project, it work perfectly. However, when I build a template folder, and put my CSS and HTML file in, the images are ...
0
votes
0
answers
40
views
How to protect a top secret python script? [duplicate]
I'm developing a project in a client-server architecture. The client is a python 3.12 script that will run on customers desktops and the server is a Django 5.0.x application. I will distribute the ...
0
votes
0
answers
23
views
How do I set up a domain name stator page for a Django web server?
Right now my server runs the Django page like this:
dato138it.ru:8000/contents.
And I need to run it from the browser like this in the browser:
dato138it.ru
It all works on a cloud server timeweb....
-2
votes
0
answers
18
views
Interact with inbuilt django DB in python files [closed]
I have a form that needs to interact with the DB inbuilt into django. How would I do that in my forms.py file. Do I just use the default sqlite3 built into python or does django have a different way ...
0
votes
1
answer
36
views
Playing an audio file on server from Django
I have a Raspberry Pi that I have hooked up to a door chime sensor, so it plays different sounds as people enter the building. Right now, I just made a short script to play those sounds from whatever ...
0
votes
1
answer
27
views
dj-rest-auth and django allauth email addresses model
When I try to delete a user already registered from the db i get this :
update or delete on table "users_user" violates foreign key constraint "...
-1
votes
0
answers
20
views
My django form keeps giving me the error message even though i still get the data i'm trying to send in the database, what could be wrong? th
I'm trying to add a staff with django everything seems to be working fine i even see the entry in the database but once i click the submit button instead message.success i get message.error i cant ...
0
votes
0
answers
33
views
Django FOREIGN KEY constraint failed when registering new users
I'm encountering a "FOREIGN KEY constraint failed" error while trying to register new users in my Django application. Here's the relevant code from my models.py, serializers.py, and views.py ...
0
votes
1
answer
22
views
Docker-compose is able to compile program but is unable to open link to Local host
I have a basic Django project that I have put into a docker container.
Currently I have it running on https locally just for the development phase because it is a requirement.
When I run my program ...
1
vote
1
answer
22
views
Django query for a select item return '---------'
I'm trying to populate a select item with a django queryset.
It's working fine but at the begining of the list of the dropdown menu on the select item I always have a '---------' as first option.
...
0
votes
0
answers
42
views
NOT NULL constraint failed on PUT request in Django [duplicate]
I'm new to Django and I'm having trouble handling form-data and raw data in PUT requests. I need to update records of a Person model via a PUT request. The Person model has several fields including ...
0
votes
0
answers
17
views
using nginx host multiple django apps/docker in one server. return to root path not the apps' path
I have a django app. The code snippet for the function load_form(request) in views.py.
def load_form(request):
if request.method == 'POST':
newQAForm = QAForm(request.POST)
if ...
0
votes
1
answer
32
views
Best approach to object creation in the background without using a task queue system?
I have been thinking of the best approach to a record creation in the background without using django signals, or celery, etc.
I do not want to use signals due to the fact that the sender Model would ...
-1
votes
1
answer
28
views
Is there a way to create a run configuration for a manage.py command in Pycharm [duplicate]
I want to be able to run a manage.py management command via a Pycharm run configuration. Is there a way to do this?
0
votes
1
answer
31
views
htmx insert multiple table rows
I'm using Django, if that makes any difference. Anyway, I have this tbody element in my template:
<tbody
id="log-stream-table-body"
hx-get="{...
0
votes
0
answers
23
views
How to access a translation defined in the base model from views and the admin panel of a child model
In a project I have inherited I have a few polymorphic models based on a common model. Something like:
from django.db import models
from polymorphic.models import PolymorphicManager, PolymorphicModel
...