Opened 3 years ago

Closed 3 years ago

#31092 closed Bug (duplicate)

Django 3 runserver command stops after login into admin page

Reported by: Alejandro Otero Ortiz de Cosca Owned by: nobody
Component: Utilities Version: 3.0
Severity: Normal Keywords: dev, server, runserver, admin, login
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no



The Django 3 development server halts when login into the admin page. The dev server (runserver) serving a blank (straight after running startproject) project responds fine to the welcome page and the admin login form page, but it crashes when redirecting after a successful login.

  • The dev server starts without errors or warnings.
  • All requests are responded correctly (base endpoint and admin login page).
  • Login request seems to be processed correctly, client gets the 302 redirection to the admin page after login.
  • Server stops working without printing any error.

Dev server output

Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
December 15, 2019 - 12:52:00
Django version 3.0, using settings 'admin_login_issue.settings'
Starting development server at
Quit the server with CONTROL-C.
[15/Dec/2019 xx:xx:xx] "GET /admin/ HTTP/1.1" 302 0
[15/Dec/2019 xx:xx:xx] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 1913
[15/Dec/2019 xx:xx:xx] "GET /static/admin/css/base.css HTTP/1.1" 304 0
[15/Dec/2019 xx:xx:xx] "GET /static/admin/css/login.css HTTP/1.1" 304 0
[15/Dec/2019 xx:xx:xx] "GET /static/admin/css/responsive.css HTTP/1.1" 304 0
[15/Dec/2019 xx:xx:xx] "GET /static/admin/css/fonts.css HTTP/1.1" 304 0
[15/Dec/2019 xx:xx:xx] "POST /admin/login/?next=/admin/ HTTP/1.1" 302 0

System description

  • Python 3.7.0
  • Django 3.0
  • Mac OS Mojave 10.14.6

Reproduction steps

  • Create virtualenv
  • Install Django==3.0
  • Create django project
django-admin startproject admin_login_issue
  • Run migrations
python migrate
  • Create superuser
python createsuperuser
  • Start development server
python runserver
  • Access
  • Login with your superuser. You should get an error connecting to the server.
  • Check the running server. It should not be running.

Change History (2)

comment:1 Changed 3 years ago by Alejandro Otero Ortiz de Cosca

I have created a new virtualenv with Python 3.8 and the client can access the admin portal but the server log shows an exception:

[15/Dec/2019 13:20:54] "GET /admin/ HTTP/1.1" 302 0
[15/Dec/2019 13:20:54] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 1913
Exception happened during processing of request from ('', 52778)
Traceback (most recent call last):
  File "/Users/aotero/.pyenv/versions/3.8.0/lib/python3.8/", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "/Users/aotero/.pyenv/versions/3.8.0/lib/python3.8/", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/Users/aotero/.pyenv/versions/3.8.0/lib/python3.8/", line 720, in __init__
  File "/Users/aotero/.pyenv/versions/3.8.0/envs/admin_login_issue-3.8.0/lib/python3.8/site-packages/django/core/servers/", line 174, in handle
  File "/Users/aotero/.pyenv/versions/3.8.0/envs/admin_login_issue-3.8.0/lib/python3.8/site-packages/django/core/servers/", line 182, in handle_one_request
    self.raw_requestline = self.rfile.readline(65537)
  File "/Users/aotero/.pyenv/versions/3.8.0/lib/python3.8/", line 669, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [Errno 54] Connection reset by peer
[15/Dec/2019 13:20:58] "POST /admin/login/?next=/admin/ HTTP/1.1" 302 0
[15/Dec/2019 13:20:58] "GET /admin/ HTTP/1.1" 200 3043
[15/Dec/2019 13:20:58] "GET /static/admin/css/dashboard.css HTTP/1.1" 304 0
[15/Dec/2019 13:20:58] "GET /static/admin/img/icon-addlink.svg HTTP/1.1" 304 0
[15/Dec/2019 13:20:58] "GET /static/admin/img/icon-changelink.svg HTTP/1.1" 304 0
Version 3, edited 3 years ago by Alejandro Otero Ortiz de Cosca (previous) (next) (diff)

comment:2 Changed 3 years ago by Baptiste Mispelon

Resolution: duplicate
Status: newclosed


This seems like a duplicated of issue #31067 which should be fixed by upgrading your Python version to the latest supported version in the 3.7 branch (3.7.5 I think).

Please reopen if that's not the case, thanks.

Note: See TracTickets for help on using tickets.
Back to Top