Error at login page of Django Admin

101 views
Skip to first unread message

Stephen Farry

unread,
May 16, 2018, 11:06:54 AM5/16/18
to Django users
Hi All,

I have a peculiar issue with the admin on Django. Using the Django development server, I can use the admin without any issues at all. However, when I deploy it on the server, I still get the admin page, but when I try to log in I get a 404 error. I reduced this back to the tutorial, but I still get this with any username/password (with DEBUG is True)

Page not found (404)

Request Method:POST
Request URL:https://themovieroom.co.uk/mysite/admin/login/?next=/mysite/admin/

Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:

  1. ^admin/
  2. polls/

The current path, login/, didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.



This seems to be the same whatever sql database I get, and I suspect is a server side problem, but I'm not sure where to look. Let me know any further information would help. Thanks for any help you can provide.

Cheers,
Stephen

James Farris

unread,
May 16, 2018, 12:00:01 PM5/16/18
to django...@googlegroups.com
Did you run python manage.py migrate on your dev server? And create a super user (python manage.py createsuperuser)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a5170810-329f-440b-bc30-64a89d15a8aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stephen Farry

unread,
May 16, 2018, 12:04:08 PM5/16/18
to Django users
Hi James,

Thanks for the reply. Yes, I did both of these (a few times to be sure!), but unfortunately it still doesn't seem to work. Actually the database itself seems to be working fine, it's just the admin that's the problem.

Cheers,
Stephen

Julio Biason

unread,
May 16, 2018, 1:09:44 PM5/16/18
to django...@googlegroups.com
Hi Stephen,

How are you deploying? Are you using uwsgi and nginx? 'Cause there is an option on the nginx document configuration that you an point to drop a prefix -- in this case, the "mysite/" prefix. If you don't use it, Django will receive the whole path, "/mysite/admin/login" and won't find it in its routes.

I'm 60% sure it is something like this :p

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.



--
Julio Biason, Sofware Engineer
AZION  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101  |  Mobile: +55 51 99907 0554

Stephen Farry

unread,
May 16, 2018, 1:54:14 PM5/16/18
to django...@googlegroups.com
Hi Julio,

Thanks a lot for the response! Unfortunately no, the deployment is done with wsgi and apache using shared hosting :(. I actually also get the error if I don't use the prefix (the mysite part was just a test) so that possibly means that the prefix isn't causing the issue, but I could easily be wrong about that!

Cheers,
Stephen

Reply all
Reply to author
Forward
0 new messages