In the admin console, I can add and edit users through the standard auth app and sites through the standard site app, but if I try to add a group, I receive a 404 error that lacks the usual URLconf listing:
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/auth/group/add/
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.
There are no groups in the database, and I can visit http://127.0.0.1:8000/admin/auth/group/
and see the empty list just fine.
For flatpages, there are entries in the database, and all SITE_IDs match my settings files. In this case, though, both http://127.0.0.1:8000/admin/flatpages/flatpage/
(which should list them) and http://127.0.0.1:8000/admin/flatpages/flatpage/add/
give 404 errors with no URLconf information given.
The public side of the flatpages does work. All content is served up as expected. The issue is only in the admin console.
Here are the contents of my urls.py file:
from django.conf.urls.defaults import *
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^shortener|g|p/', include('charon_sheet.shortener.urls')),
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/', include(admin.site.urls)),
(r'^', include('charon_sheet.ghosts.urls')),
)
if settings.DEBUG:
urlpatterns += patterns('',
(r'^public/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes':True }),
)
I have no custom apps that touch the admin interface, and so no admin.py files.
Here's my middleware:
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)
My template context processors:
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.media',
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.request',
'charon_sheet.context_processors.sharing_url_context_processor',
)
And my installed apps:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.flatpages',
'django.contrib.messages',
'charon_sheet.shortener',
'charon_sheet.ghosts',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
'django.contrib.admindocs',
)
I've tried the following:
None of these have changed the errors at all.
This is using Django 1.3 and python 2.6, and is happening both on the standard dev server and through Passenger in a more production-like environment.
I'm running out of ideas to try on this. Any ideas? Here's hoping it's something simple.
As expected, this was a URL pattern issue. Here are the contents of the charon_sheet.shortener.urls
file:
urlpatterns = patterns(
'',
url(r'shorten/(?P<app_prefix>.*?)/$',
view = shorten,
name = 'shorten'
),
url(r'(?P<id_hex>[a-fA-F0-9]+)(/)?$',
view = expand,
name = 'expand'
)
)
The last pattern there was gobbling up certain URLs. Moving the inclusion of charon_sheet.shortener.urls
file down below the admin pattern solved the issue.