Achimnol
Achimnol

Reputation: 1599

admin/appname/modelname urls does not work with mod_wsgi in Django 1.1rc1

I'm using Django 1.1 rc1 and Apache 2.2.8 on Ubuntu with mod_wsgi 1.3.1 + Python 2.5.2.

Everything worked fine with Django's internal testing web server, but after migrating to Apache mod_wsgi, all urls like /admin/appname/modelname/ began not to work. They shows 404 not found errors with the following log:

...
^admin/ ^$
^admin/ ^logout/$
^admin/ ^password_change/$
^admin/ ^password_change/done/$
^admin/ ^jsi18n/$
^admin/ ^r/(?P<content_type_id>\d+)/(?P<object_id>.+)/$
^admin/ ^(?P<app_label>\w+)/$
The current URL, admin/account/userprofile/, didn't match any of these.

Strangely, /admin/appname/ and all other parts including my custom urls just work fine.

Is it a bug of Django or configuration issue? And how to solve it?

Upvotes: 2

Views: 477

Answers (1)

Frozenskys
Frozenskys

Reputation: 4410

I know that 1.1RC1 made some changes to the admin URL resolver to use namespaces: this might be your problem.

see here: http://docs.djangoproject.com/en/dev/releases/1.1-rc-1/

Other than that it looks like the URLs are not correct as the last line of the urls in the debug trace would only match /admin/app/ rather than /admin/app/xxxx. The information here might help.

for some reason this ^admin/ ^r/(?P\d+)/(?P.+)/$ doesn't look right wouldn't that give /admin//xxx/yyy/ ?

Edit: no it gives /admin/r/xxx/yyy/

I can't test this right now as I only have 1.0.2 available on this computer (and no mod_wsgi) - I will test on 1.1 when I get home tonight.

Edit: Looks like this

for model, model_admin in self._registry.iteritems():
    urlpatterns += patterns('',
       url(r'^%s/%s/' % (model._meta.app_label, model._meta.module_name),
            include(model_admin.urls))
    )
return urlpatterns

is not working for some reason, as the URLs are not included in the search path in the debug trace. Are the admin.py files correct?

Upvotes: 1

Related Questions