#11918: Admin URLs troubles -----------------------------------+---------------------------------------- Reporter: camilonova | Owner: nobody Status: closed | Milestone: Component: Contrib apps | Version: 1.1 Resolution: invalid | Keywords: admin urls 404 Stage: Unreviewed | Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | -----------------------------------+---------------------------------------- Changes (by toby...@gmail.com):
* status: reopened => closed * resolution: => invalid * needs_tests: 1 => 0 Comment: Sorry, this is not a django issue the registration of models with the admin site should not live in models.py Taken from: http://groups.google.com/group/django- users/browse_thread/thread/1e3ac5beaa4ab370/1fe62a0d92a6797e?lnk=gst&q=admin+urls+not+working+correctly#1fe62a0d92a6797e "You've put your admin.site.register call in models.py. This should go in an admin.py file, not models.py. Whether your model is registered with admin is being determined by the accident of whether your models.py file has happened to be loaded at the time you attempt to access it in admin. Your models.py file will have been loaded when running under the development server, since it does explicit model validation during startup. Similarly the admin validation done when DEBUG=True will have ensured that your models.py file is loaded when you first attempt to access admin. When running under Apache with DEBUG=False, however, there has not necessarily been any need to load your models.py by the time you attempt to access admin. That's why you are getting 404 errors...that call to admin.site.register has not yet been made. admin.autodiscover() and placing admin registrations in admin.py files (what are loaded by admin.autodiscover()) ensures that model registrations happen once and only once, at a predictable time, regardless of deployment scenario and debug setting. If you move your admin registrations to an admin" -- Ticket URL: <http://code.djangoproject.com/ticket/11918#comment:4> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.