I've just been porting to Python3 from 2 and upgrading Django from 1.7 to 2.0 (massive changes I know). I'm using Heroku to host the app.
When I run heroku local or just run the app locally with manage.py runserver the app loads but navigating to the /admin page comes up with the error:
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:5000/admin
Using the URLconf defined in loowatt.urls, Django tried these URL patterns, in this order:
write/
admin/
^$ [name='index']
The current path, admin, didn't match any of these.
My new app.urls.py looks like this:
1 from django.contrib import admin
2 from django.urls import include, path
3
4 from . import views
5
6 urlpatterns = [
7 path('write/', views.write),
8 path('admin/', admin.site.urls),
9 path('', include('units.urls')),
10 ]
And my settings have all the correct middleware and context processors for the admin settings:
21 INSTALLED_APPS = [
22 'django.contrib.admin',
23 'django.contrib.auth',
24 'django.contrib.contenttypes',
25 'django.contrib.sessions',
26 'django.contrib.messages',
27 'units.apps.UnitsConfig',
28 # Disable Django's own staticfiles handling in favour of WhiteNoise, for
29 # greater consistency between gunicorn and `./manage.py runserver`. See:
30 # http://whitenoise.evans.io/en/stable/django.html#using-whitenoise-in-development
31 # 'whitenoise.runserver_nostatic',
32 'django.contrib.staticfiles',
33 'import_export',
34 'rangefilter',
35 ]
37 MIDDLEWARE_CLASSES = [
38 'django.middleware.security.SecurityMiddleware',
39 'whitenoise.middleware.WhiteNoiseMiddleware',
40 'django.contrib.sessions.middleware.SessionMiddleware',
41 'django.middleware.common.CommonMiddleware',
42 'django.middleware.csrf.CsrfViewMiddleware',
43 'django.contrib.auth.middleware.AuthenticationMiddleware',
44 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
45 'django.contrib.messages.middleware.MessageMiddleware',
46 'django.middleware.clickjacking.XFrameOptionsMiddleware',
47 ]
53 TEMPLATES = [
54 {
55 'BACKEND': 'django.template.backends.django.DjangoTemplates',
56 'DIRS': [],
57 'APP_DIRS': True,
58 'OPTIONS': {
59 'context_processors': [
60 'django.template.context_processors.debug',
61 'django.template.context_processors.request',
62 'django.contrib.auth.context_processors.auth',
63 'django.contrib.messages.context_processors.messages',
64 ],
65 'debug': DEBUG,
66 },
67 },
68 ]
Anyone have any ideas of what they'd try next to get it working?