How do you log server errors on django sites

So, when playing with the development I can just set settings.DEBUG to True and if an error occures I can see it nicely formatted, with good stack trace and request information. But on kind of...

Print a stack trace to stdout on errors in Django while using manage.py runserver

I did some searching, but I'm wondering if anyone has a snippet of a logging configuration to get Django to just output a stack trace to stdout (so I can see it in the Terminal window) when it...

Missing custom header with django, nginx and gunicorn

Disclaimer: I'm working in a project where exist an "huge" webapp that have an api for mobiles, so change the api is not an option. This application was developed time ago and several developers...

Django TemplateDoesNotExist at /home/

directory structure of dummy project /dummy /dummy urls.py views.py setting.py _init_ wsgi.py /template home.html settings.py TEMPLATE_DIRS =...

handle OPTIONS request with django's built in server

I am trying to make OPTIONS requests work with django but I am currently only getting 405. An answer I got here was that the server does not handle the OPTIONS request. This is the View that...

How to disable Django's invalid HTTP_HOST error?

Ever since I deployed a site running Django 1.7 alpha (checked out from Git), I've been occasionally receiving error messages with titles like: "Invalid HTTP_HOST header: 'xxx.xxx.com'" I...

Bypass signup form using allauth

Does anyone know how I would go about bypassing the signup page when using a social account in django allauth? I've got the authentication side of things working with Google but when the user...

python os.path.exists() failing for nfs mounted directory file that exists

I basically have a webserver for a site and another that simply stores files. The file server is connected to the main one by mounting one of its directories. The website runs Django so I...

django admin login suddenly demanding csrf token

I was logging into my django admin console easily a few minutes ago. I must have changed something somewhere that caused this error when logging in as superuser: Forbidden (403) CSRF verification...

django errno 104 Connection reset by peer

I am trying to run my django server on an Ubuntu instance on AWS EC2. I am using gunicorn to run the server like this : gunicorn --workers 4 --bind 127.0.0.1:8000 woc.wsgi:application --name...

Logging and email not working for Django for 500

I can't get logging to work in my Django web app. My settings file looks like this: EMAIL_HOST = "smtp.gmail.com" EMAIL_PORT = 465 EMAIL_HOST_USER = "[email protected]" EMAIL_HOST_PASSWORD =...

Django websockets implementation

I'm new to python and Django and i'm trying to implement websockets in Django. What i do is i'm following the steps described in websockets documentation The problem is that the server side...

DRF APIView move request validation to dispatch method using request.data

I've created a base api view, which extends from APIView, where I log response time, log request, and other common stuffs. Now, I also want to add request validation here, using the Serializer...

Django Python - No connection could be made because the target machine actively refused it

I have a Django python server in a virtual environment at the root of my hard drive. In the command line, when I activate the env and run python manage.py 192.168.0.47:80 it starts the server...

DRF + CoreAPIClient + psycopg2 throws exception, Interface error: connection already closed

I'm writing some integration tests for a web API I build using Django Rest Framework and Django 1.11. My tests are passing when I use DRF's APIClient to send requests to my API endpoints, but when...

uwsgi listen queue fills on reload

I'm running a Django app on uwsgi with an average of 110 concurrent users and 5 requests per second during peak hours. I'm finding that when I deploy with uwsgi reload during these peak hours I am...

DRF Model permissions fail for LDAP auth'd users

I'm working on an application with a DRF base, requiring LDAP authentication. I have run across a problem, by which I am seeing different behaviours for users logging in directly via the DRF API...

How to send Exceptions to sentry for a django project

Following the Sentry Django guide I've setup my project and deployed it. So I configure RAVEN_CONFIG with the SENTRY_DSN value and release values, and include raven.contrib.django.raven_compat in...

Django auto logout and page redirection

I have an application whose backend is written using django and python. I want to implement auto logout feature in my applcation. For this , I used following django built-in features...

React app throws 401 error when accessed through safari, but not otherwise

I have a react app hosted in an s3 bucket behind a cloudfront distribution. This talks to a django server. Login works correctly on all browsers (confirmation that credentials are correct, and no...

drf - use serializers only for post() method

I am using Django Rest Framework. I have defined a serializer - ReceiptLog with no model, which should create entries in TestCaseCommandRun and TestCaseCommandRunResults when a post() request is...

Implementing Session authentication in django rest framework

I am trying to implement a session based auth in DRF. I don't understand a thing from django session documentation as well as from DRF documentation. I want to have an API endpoint for login ,...

nginx logs appear to show the wrong info

I'm running nginx with Django on a production server, with the following settings: # normally you leave this at the default of 1024 events { worker_connections 1024; } http { # cf...

logger.info not working in Django logging

Following is the logging snippet I have used in my django settings.py file. All the GET,POST requests are getting written to log but when i wrote logger.info("print something"), its not getting...

How to fix CSRF error on logging in using REST API in Django Rest Framework?

I am beginner to Django, following this tutorial to implement register, login and logout using DRF. The register is working fine, but I am not able to login using postman, it is showing CSRF...

Unable to connect to postgres database from django while running pytest

Django project and postgres are in different docker containers. I want to write the unit test cases for this application using pytest. I have implemented test cases using APIClient() along with...

Django-OIDC with keycloak - OIDC callback state not found in session oidc_states

I am trying to implement Keycloak SSO with Django API using OIDC. Getting below error message after requesting the call to Keyclock as a response SuspiciousOperation at /^oidc/callback/ OIDC...

Nuxt/Vue - how to run code before a page is rendered?

I'm building a Nuxt app (SSR) that uses Django on the backend, for authenticating users i'm using the standard Django Session Auth. I'm completely stuck on the part where i need to redirect user...

CSRF token error for django app when deploying to AWS server

I have a django site that runs fine locally but when trying to deploy with AWS elastic beanstalk I get the following error when I try to login (using django allauth) Forbidden (403) CSRF...

Patch request not patching - 403 returned - django rest framework

I'm trying to test an API endpoint with a patch request to ensure it works. I'm using APILiveServerTestCase but can't seem to get the permissions required to patch the item. I created one user...