Created
June 20, 2018 19:46
-
-
Save morenoh149/39be1ace1f99b9571fd2b6b96098075d to your computer and use it in GitHub Desktop.
django admin unreachable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET http://localhost:8000/admin | |
Page not found (404) | |
Request Method: GET | |
Request URL: http://localhost:8000/admin | |
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: | |
^ ^$ [name='index'] | |
^admin/ | |
^static\/(?P<path>.*)$ | |
The current path, admin, didn't match any of these. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from django.conf.urls import include, url | |
from django.contrib import admin | |
from django.contrib.staticfiles.urls import staticfiles_urlpatterns | |
urlpatterns = [ | |
url(r'^', include('polls.urls')), | |
url(r'^admin/', admin.site.urls) | |
] | |
# Only serve static files from Django during development | |
# Use Google Cloud Storage or an alternative CDN for production | |
if settings.DEBUG: | |
urlpatterns += staticfiles_urlpatterns() |
also update middleware settings https://stackoverflow.com/questions/48100144/django-admin-error-wsgirequest-object-has-no-attribute-user/48100301#48100301
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
django 2.0 uses path, do
and open http://localhost:8000/admin
you should also update
polls/urls.py
but I'll leave that as an exercise for the reader, read the new syntax in django 2.0 at https://docs.djangoproject.com/en/2.0/intro/tutorial01/