Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
It is possible django APIView recognize request from django Testcase?
Can I determine if the request has been made from the django testcase when the request is made in django APIView? views.py class BackendView(APIView): filter_backends = (DjangoFilterBackend,) filterset_class = BackendFilter @swagger_auto_schema(responses={200: BackendSerializer()}) @transaction.atomic() def post(self, request, *args, **kwargs): # 1. service call # 2. kafka produce ## Here, I will determine whether the request has been received from the test case and try not to produce kafka if it has been received from the test case. tests.py class PrivateBackendApiTests(TestCase): def test_create_backend(self): payload = {} res = self.client.post(BACKENDS_URL, payload, format="json") self.assertEqual(res.status_code, status.HTTP_201_CREATED) -
How to email generated PDF as email attachment using xhtml2pdf
I am generating a PDF using an HTML template and xhtml2pdf render function. I would like a view that can quickly generate and email that PDF to an email field of the model. Something that doesn't store the pdf file anywhere but just uses a temporary file to email the attachment. I have been getting errors regarding 'bytes-like objects required.' Any help would be appreciated. views.py class Pdf(View): model = Pass def get(self, request, id=None, *args, **kwargs): today = timezone.now() guest = get_object_or_404(Pass,id=id) params = { 'today': today, 'guest': guest, 'request': request } return Render.render('guestpass/pdf.html', params) urls.py path('export/pass/<int:id>/', views.Pdf.as_view(),name='print'), -
Python datetime object does not change date light saving automatically when setting day
I am in NZ and we just ended daylight saving on 7th April, when I change the day of the object back to before daylight saving ends, it does not update the timezone back to +13. from django.utils import timezone In [8]: timestamp = timezone.localtime(timezone.now()) In [9]: print(timestamp) 2024-04-09 14:20:58.907339+12:00 In [10]: timestamp = timezone.localtime(timezone.now()).replace(day=1, hour=19, minute=0, second=0) In [11]: print(timestamp) 2024-04-01 19:00:00.784648+12:00 I have had a quick glance over this https://blog.ganssle.io/articles/2018/02/aware-datetime-arithmetic.html but it was talking about timedelta, is this a known issue? -
APScheduler jobstore
is it possible to add a new field to the DjangoJob model in django-apscheduler? I want to add a new field to relate it to another model, or if it's not possible to add, can I use a custom model instead of the default one? If it's possible, how can it be done? -
How to configure PingFederate SSO with SAML for application where frontend is written in react and backend Puthon django
I'M WORKING ON A PROJECT THAT INTEGRATES PING FEDERATE SSO USING SAML FOR AUTHENTICATION, WITH A FRONTEND DEVELOPED IN REACT AND A BACKEND IN DJANGO (PYTHON). I WOULD APPRECIATE YOUR INSIGHTS ON THE BEST PRACTICES TO IMPLEMENT THIS SETUP Current Understanding of the Authentication Flow: The user initiates a request to the frontend. The frontend redirects the user to the Identity Provider (IdP). The user authenticates on the IdP's website. The IdP sends a signed SAML assertion back to our frontend. Our frontend then forwards this SAML assertion to the backend for processing. Questions: Is this flow correct, or is there a more recommended approach for integrating SAML with a React/Django application? What libraries or tools would you recommend for implementing this flow in both React and Django? How should the backend validate the SAML assertion received from the frontend? I'm particularly interested in any best practices, libraries, or patterns that would make this implementation as secure and efficient as possible. Any advice or resources you could share would be greatly appreciated. -
Django Test Fails with OperationalError on Tenant Deletion in Multi-Tenant PostgreSQL Setup
I'm encountering a specific issue when running test cases in a Django project that involves a multi-tenant PostgreSQL database setup. The process I'm testing is tenant deletion, and it's noteworthy that this error only appears during tests, while the actual application runs without any issues in a actual run. Error Messages: During the test execution, I'm hit with two errors in sequence: django.db.utils.OperationalError: cannot DROP TABLE "model_name_1" because it has pending trigger events django.db.utils.InternalError: current transaction is aborted, commands ignored until end of transaction block Detailed Context: The issue manifests when running a Django test that tests the deletion of a tenant and its associated data. Specifically, the errors are triggered at the line where the tenant is deleted using tenant.delete(force_drop=True). The test case sets up data for models that include foreign key relationships, and it is under these conditions that the errors are observed: def test_tenant_deletion(tenant, monkeypatch): with tenant_context(tenant): model_1.objects.create(name="Test date", process_id="process") model_2.objects.create(name="Test date", model_1=model_1.objects.first()) payload = { "eventId": "abcdef", "type": "DELETED", "tenant": {"tenantId": str(tenant.id)}, } event = Mock(link=Mock(source=Mock(address="delete_tenant")), message=Mock(body=json.dumps(payload))) listener = BTPMessageQueueListener(SOLACE_BROKER_URL, SOLACE_BROKER_USER, SOLACE_BROKER_PASSWORD) listener.on_message(event) assert not Tenant.objects.filter(id=tenant.id).exists() Observations: The operation tenant.delete(force_drop=True) proceeds without errors in a real run. The errors are specific to the testing environment, particularly … -
How do you reference a model name in a Django model mixin field definition?
How do you reference the model name in field definition in a model mixin? Ie, what would replace model_name here: class CreatedByMixin(models.Model): class Meta: abstract = True created_by = ForeignKey( User, verbose_name="Created by", help_text="User that created the record", related_name=f"{model_name}_created", editable=False, ) Such that the related name on this model is 'MyModel_created'? class MyModel(UserAuditMixin, TimeStampedModel): class Meta: db_table_comment = "Participants are the users that are involved in the transcript" field1 = models.TextField() -
what should I choose : Django or Node.js? [closed]
I am a solo developer who has been freelancing for a year, and now I have a project related to CRM on which I am going to work in a team. One of my team members said, Let's go with Django, and the other said, Why don't we use Node?". I am comfortable with both and deciding which to choose! Here is the project outline: we get data from users, generate digital documents, agreements, quotations, and invoices, and mail them to the user accordingly. In short, this project is related to audit services. So, kindly let me know, guys, which stack I should choose with pros and cons. -
Django logging isn't working, despite having proper settings
Problem and background Hi, I have a Django project using Django 2.2.28, and python 3.5.2. The live site runs fine, except for one function I'm trying to debug. I've used logging before, but for some reason it's not working now. Here's my code... production_settings.py I call this file in wsgi.py. It's settings all work as they should, but LOGGING isn't. from .settings import * DEBUG = False LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'file': { 'level': 'DEBUG', 'class': 'logging.FileHandler', 'filename': '/home/myuser/proj_container/debug.log', }, }, 'loggers': { 'django.request': { 'handlers': ['file'], 'level': 'DEBUG', 'propagate': False, }, }, } views.py import logging logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) def some_func(request): ... if some_condition: logger.debug('In some_condition block') elif some_other_condition: logger.debug('In some_other_condition block') What I've tried I've tried the above with just the settings in production_settings.py... Nothing shows up. Same as 1, but with logging imported and called at every important code block. I read the docs for logger.debug(), as well as this answer that I implemented above as you can see. I also reread the Django logging docs. I moved LOGGING from production_settings.py to settings.py... Yesterday I fixed a bug where django wasn't overriding the DATABASES variable in settings.py from production_settings.py, and was … -
Django HTTPResponseRedirect not redirecting to the url but rather adding the integer to the url
This is my view.py file from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound, Http404, HttpResponsePermanentRedirect from django.urls import reverse from django.shortcuts import render articles = { 'sports': 'sports page', 'finance' : 'finance page', 'tech' : 'tech page', } def home_view(request): return HttpResponse("My App Home Page") def news_view(request, topic): try: result = articles[topic] return HttpResponse(result) except: raise Http404("404 Generic view error") def mul_view(request,num1,num2): num_result = num1 * num2 result = f"{num1} * {num2} = {num_result}" return HttpResponse(str(result)) def num_page_view(request, num_page): topic_list = list(articles.keys()) topic = topic_list[num_page] return HttpResponseRedirect(topic) and this is my url file of the app from django.urls import path from . import views urlpatterns = [ path('<int:num_page>/', views.num_page_view, name='num_page'), # path('', views.home_view, name='home'), path('<topic>/', views.news_view, name='topic-page'), path('<int:num1>/<int:num2>/', views.mul_view, name='multiply'), ] What's happening here is a bit hard to explain for me as english is not my first language but here is my best effort. I have created a function num_page_view that takes a number as a parameter and has a list of all keys of articles dictionary then the number is provided to the list as an index and stored into a variable topic that is then send as the output in the HttpResponseRedirect then i added a a new path … -
Django makemessages, TypeError: expected str, bytes or os.PathLike object, not list
I'm trying to create a multi language Django project in pycharm. But have struggled for the whole day figuring out why the makemessages doesn't generate .po files. So I reach out for some help. settings.py from pathlib import Path import os from decouple import config from unipath import Path from django.utils.translation import gettext_lazy as _ import environ env = environ.Env() environ.Env.read_env() BASE_DIR = Path(__file__).resolve().parent.parent CORE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) LOCALE_PATHS = ( os.path.join(BASE_DIR, 'locale/'), ) LANGUAGE_CODE = 'en-us' LANGUAGES = [ ('en', _('English')), ('fr', _('French')), ] TIME_ZONE = 'UTC' USE_I18N = True USE_TZ = True When I run python manage.py makemessages -l fr I get the following response: Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/django_manage.py", line 52, in <module> run_command() File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/django_manage.py", line 46, in run_command run_module(manage_file, None, '__main__', True) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 225, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 97, in _run_module_code _run_code(code, mod_globals, init_globals, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/Users/famronnebratt/PycharmProjects/CompValid3/manage.py", line 22, in <module> main() File "/Users/famronnebratt/PycharmProjects/CompValid3/manage.py", line 18, in main execute_from_command_line(sys.argv) File "/Users/famronnebratt/PycharmProjects/CompValid3/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/Users/famronnebratt/PycharmProjects/CompValid3/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/famronnebratt/PycharmProjects/CompValid3/venv/lib/python3.9/site-packages/django/core/management/base.py", line 412, in run_from_argv self.execute(*args, **cmd_options) File "/Users/famronnebratt/PycharmProjects/CompValid3/venv/lib/python3.9/site-packages/django/core/management/base.py", line 458, in execute output = … -
Can't serve django App behind Apache + Nginx
I have a Django App that I'm trying to deploy on our dev server through a domain name. Our dev server uses apache, while I use nginx to serve my app and static/media files. If I deploy it locally on my computer (localhost:port) everything works perfectly. Once I try it on our dev server, I cannot connect to the websocket endpoint. First of all I deploy my app with a docker-compose.yml consisting of an nginx, django app, redis and postgres services. Below is my nginx conf file server { listen 80; listen 443 default_server ssl; server_name localhost; charset utf-8; location /static { alias /app/static/; } location /upload { alias /app/media/; } location / { proxy_pass http://web:8000; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_set_header Host $http_host; proxy_redirect off; } location /ws/ { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_redirect off; proxy_pass http://web:8000; } } And here is my apache conf <IfModule mod_ssl.c> <VirtualHost *:443> ServerName our.dev.server <Location /> ProxyPass http://127.0.0.1:89/ ProxyPassReverse http://127.0.0.1:89/ # Proxy WebSocket connections to your application RewriteEngine On RewriteCond %{HTTP:Upgrade} websocket [NC] RewriteCond %{HTTP:Connection} upgrade [NC] RewriteRule ^/ws/(.*)$ ws://127.0.0.1:89/$1 [P,L] </Location> SSLCertificateFile /etc/letsencrypt/live/our.dev.server/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/our.dev.server/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf RequestHeader add X-Forwarded-Proto "https" </VirtualHost> </IfModule> When I try … -
Ajax request works succesfully in local but not working in web server. I use Django, Docker. I loads long time and after
Ajax request works successfully locally but not on the web server. I'm using Django and Docker. I've checked all my settings in my docker-compose.yml, Dockerfile, settings.py, urls.py, etc. After loading for a long time, the console shows a message saying "no response." Here's my Ajax view: function ShowOTP () { $.ajax({ url: '/createcustomer/', type: "POST", data: { 'first_name': $('#first_name').val(), 'last_name': $('#last_name').val(), 'number_prefix': $('#number_prefix').val(), 'phone_number': $('#phone_number').val(), 'otp_form': 'otp_form' }, success: (response) => { if (response["valid"] == 'True') { document.getElementById('otpshow').click(); countdownOTP("#countdown", 2, 0); } if (response["valid"] == 'False') { window.location = '' } }, error: (error) => { console.log('error'); console.log(error); } }); }; -
How does Django BooleanField work with RadioSelect?
I have a model with a boolean class MyModel(models.Model): ... current_measures = models.BooleanField( verbose_name=_("Is there any control and safety measures?"), choices=BOOLEAN_CHOICE, ) ... I have a form that should set a value on this field using either true or false values. class MyForm(forms.ModelForm): ... current_measures = forms.BooleanField( widget=WidgetRadioSelectCustomAttrs( RADIO_WIDGET_ATTRS, choices=Risk.BOOLEAN_CHOICE ), label=_("Is there any control and safety measures?"), label_suffix="", required=True, ) ... Everything works fine until I set required=True on my form field and send the value "False" to validation method. In this case it raises ValidationError('Current measures is required') As I found out while debuging, the issue is with validate method of forms.BooleanField. At first it runs the method to_python, witch converts my value 'False' (type string) to False (type bool). def to_python(self, value): """Return a Python boolean object.""" # Explicitly check for the string 'False', which is what a hidden field # will submit for False. Also check for '0', since this is what # RadioSelect will provide. Because bool("True") == bool('1') == True, # we don't need to handle that explicitly. if isinstance(value, str) and value.lower() in ("false", "0"): value = False else: value = bool(value) return super().to_python(value) Then the validate method of BooleanField class is being … -
how to verify Django hashed passwords in FastAPI app
So I have a Python project in Django and I'm trying to change it to FastAPI. The passwords in the database are already hashed (I'm using the same database from the Django project), the passwords in the database start with pbkdf2_sha256$260000$. I'm trying to do the login function, but I'm having trouble with the password, I get an error "raise exc.UnknownHashError("hash could not be identified") passlib.exc.UnknownHashError: hash could not be identified" when I insert the username and password in my fastapi login form. #Security config security = HTTPBasic() pwd_context = CryptContext(schemes=["pbkdf2_sha256"], deprecated="auto") async def login(request: Request): form = await request.form() username = form.get("username") password = pwd._context(form.get("password")) db = database.SessionLocal() user = db.query(models.User).filter(models.User.username == username).first() if not user or not pwd_context.verify(password, user.password): raise HTTPException(status_code=401, detail="Invalid username or password") token = create_jwt_token(user.id) response = RedirectResponse(url="/index", status_code=301) response.set_cookie(key="token", value=token) return response I'm trying to hash the password the user inserts so it can be verified with the hashed password in the database. I've also tried password = form.get("password"), and the error still pops up. This is the error: File "C:\Users\user\Desktop\VSPRojects\LoginFastapi\db\views.py", line 53, in login if not user or not pwd_context.verify(password, user.password): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\Desktop\VSPRojects\LoginFastapi\venv\Lib\site-packages\passlib\context.py", line 2343, in verify record = self._get_or_identify_record(hash, scheme, category) … -
Django: object has no attribute after annotation; Got AttributeError when attempting to get a value for field <field_name> on serializer
I have a custom user model and subscription model, which contains ForeignKeys to subscriber and user to subscribe to. class Subscription(models.Model): user = models.ForeignKey( ApiUser, on_delete=models.CASCADE, related_name='subscriber' ) subscription = models.ForeignKey( ApiUser, on_delete=models.CASCADE, related_name='subscriptions' ) Also i have viewset for subscription and two serializers: for write and for read. class SubscribeViewSet(mixins.ListModelMixin, mixins.CreateModelMixin, mixins.DestroyModelMixin, viewsets.GenericViewSet): queryset = ApiUser.objects.all() serializer_class = SubscriptionSerializerForRead permission_classes = (permissions.AllowAny,) def get_queryset(self): queryset = ApiUser.objects.all().annotate( is_subscribed=Case( When( subscribtions__exact=self.request.user.id, then=Value(True) ), default=Value(False), output_field=BooleanField() ) ).order_by('id') return queryset def get_serializer_context(self): context = super().get_serializer_context() context.update({'subscription_id': self.kwargs['pk']}) return context def get_serializer_class(self): if self.request.method not in permissions.SAFE_METHODS: return SubscriptionSerializerForWrite return SubscriptionSerializerForRead @action( methods=['POST'], detail=True, url_path='subscribe' ) def subscribe(self, request, pk): serializer = self.get_serializer(data=request.data) serializer.is_valid(raise_exception=True) serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) class SubscriptionSerializerForRead(serializers.ModelSerializer): is_subscribed = serializers.BooleanField() class Meta: model = ApiUser fields = ( 'email', 'id', 'username', 'first_name', 'last_name', 'is_subscribed' ) class SubscriptionSerializerForWrite(serializers.ModelSerializer): user = serializers.StringRelatedField( required=False, read_only=True, default=serializers.CurrentUserDefault() ) subscription = serializers.PrimaryKeyRelatedField( read_only=True ) class Meta: model = Subscription fields = ('user', 'subscription') def validate(self, attrs): attrs['user'] = self.context['request'].user attrs['subscription_id'] = self.context['subscription_id'] if self.context['request'].user.id == self.context['subscription_id']: raise serializers.ValidationError( 'Cannot subscribe to yourself' ) return attrs def to_representation(self, instance): return SubscriptionSerializerForRead( instance=instance.subscription ).data After successful subscription i need to return response with subscribed user data … -
How to implement an API database-connection to replace Django's functions
I have a project running in Django that handles all of my database actions through urls and views. I want to change this to Postgres and use an API that instead handles all of my database actions. This would be my first API so i'm not sure what the optimal process of designing it would be. So far I have just initialised a new project, I want to use Typescript and express.js. -
Why can’t I deactivate the virtual environment?
here is my problem that didn't help either and it is now in double brackets, and not in single brackets as before -
Django coverage test doesn't seem to run all app tests
I am using coverage to check how much code I have covered with my test suite. It seems to not run some tests when I run the complete test suite but does if I only run an app. For example coverage run manage.py test followed by covereage html shows the api app has a 24% coverage. But when I run coverage run manage.py test api followed by coverage html I get 100% covered. Why would this happen? -
Upgrade graphene-django to v3: 'Int cannot represent non-integer value"
I'm trying to upgrade graphene-django from 2.15.0 to 3.2.0. After some fixes, I could get it to work, but while testing with the front-end, I start detecting errors of the type: "Variable '$height' got invalid value '5'; Int cannot represent non-integer value: '5'" Apparently graphene-django 2.15 can translate string arguments (in this case '5') into number values, but 3.2 it can't. Is there a way to adapt the back-end so I don't have to change the front-end to correct the strings and turn them into numbers? -
Django + react with apache can't find django rest api
I have a django + react app that i wish to deploy on my VPS. I've installed apache for that and tried to configure it to work with django and react. When i only put django in the apache conf it does work with a curl command to the django api and react always works fine. But when putting django and react together in the conf file in apache it seems like when making post or get requests to the api it doesn't find the django api. Here is my app.conf in apache : <VirtualHost *:80> ServerName vps-*******.vps.ovh.net WSGIDaemonProcess app python-path=/home/gabriel/scanner:/home/gabriel/venv/lib/python3.11/site-packages WSGIProcessGroup app WSGIScriptAlias /api /home/gabriel/scanner/App/wsgi.py <Directory /home/gabriel/scanner/App> <Files wsgi.py> Require all granted </Files> </Directory> Alias /static /home/gabriel/scanner/staticfiles <Directory /home/gabriel/scanner/staticfiles> Require all granted </Directory> Alias /static-react /home/gabriel/scanner/frontend/build/static <Directory /home/gabriel/scanner/frontend/build/static> Require all granted </Directory> <Directory /home/gabriel/scanner/frontend/build> Options FollowSymLinks Require all granted RewriteEngine on RewriteCond %{REQUEST_URI} !^/api RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L] </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> CORS is allowed for all origins in my settings.py in django for testing and the whole settings.py file seems nicely configured. wsgy.py is nicely configured too and here is my urls.py : from django.contrib import admin from django.urls … -
Nginx can't serve Django url over Gunicorn Docker container
I am trying to deploy my Django Docker application with Nginx and Gunicorn.I followed this tutorial.I also managed to run my Django app on :8000 and Nginx on :80, I can reach both :80 and :8000 but when I try to connect to for example :80/app I just get a 404, at the same time I can connect to :8000/app. My main Docker File looks like: FROM python:3.10.6-alpine RUN pip install --upgrade pip COPY ./requirments.txt . RUN pip3 install -r requirments.txt COPY ./proto /app WORKDIR /app COPY ./entrypoint.sh / ENTRYPOINT [ "sh", "/entrypoint.sh" ] this run my entrypoint.sh: python manage.py migrate --no-input python manage.py collectstatic --no-input gunicorn proto.wsgi:application --bind 0.0.0.0:8000` and my compose.yml looks like: version: '3.7' services: django_proto: volumes: - static:/static env_file: - .env build: context: . ports: - "8000:8000" nginx: build: ./nginx volumes: - static:/static ports: - "80:80" depends_on: - django_proto volumes: static: and my default.conf: upstream django { server django_proto:8000; } server { listen 80; location /static/ { alias /app/static; } location / { proxy_set_header Host $http_host; proxy_pass http://django; proxy_redirect off; } } I tried different folder constructs because I thought I was just trying to connect to the wrong folder path, I also tried different ports … -
Code on Django does not reflect on the created website
I'm currently learning how to use django so I watch a youtube video and its Tech with Tim. His tutorials are good and I followed all his instructions but unfortunately, I did not get the expected result. I try asking chatgpt but somehow it cannot help me to fix this problem. Please help me on this problementer image description hereenter image description hereenter image description here the problemproblem error 404 -
Unable to create a django project showing attribute error in django5.0
I am new to django while using django version 1.11.29 it worked successful when upgraded to latest version 5.0.4 it not working and showing error as below try this on venv shown same result is problem with python ,my python version 3.13.0a5+ I was tried to get django versio by python3 -m django --version it has been shown no module named django found -
Speed up problem with response Django REST API
We are got a project on gunicorn,django and nginx. Got a table in postgres with 600000 records with a big char fields(about 7500). That problem solved by triggers and searchvector. Also there api(rest) and 1 endpoint. On this endpoint db request take about 0.3 s. Its normal for us. But getting response take about 2 minutes.While we are waiting for a response one of process(they are a 8 cores) take about 100%. CPU User CPU time 201678.567 ms System CPU time 224.307 ms Total CPU time 201902.874 ms TOTAL TIME 202161.019 ms SQL 385 ms What we can to do to speed up time of response? I tryed to change settings if gunicorn,but that doesnt help. Than I try to start project by ./manage.py runserver on unused port and send request to endpoint and got the same results of time. I think the problem with view of REST API django. Django work with asgi now ,gunicorn and nginx.