On Sat, 2009-02-28 at 18:42 +0100, felix wrote: > Mysteriously my site is occasionally throwing errors. When I go check > the URL (not logged in) there is no such error. > > Last night the suddenly site went down for many hours, throwing the > errors below on every response. > Actually I'm not sure if its every response or perhaps one misguided > process. > > WSGIDaemonProcess crucial-systems.com processes=2 threads=15 > maximum-requests=1000 inactivity-timeout=10000 > > > Restarted and everything works fine again. > > File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py", > line 77, in get_response > request.path_info) > > File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py", > line 178, in resolve > for pattern in self.urlconf_module.urlpatterns: > > File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py", > line 197, in _get_urlconf_module > self._urlconf_module = __import__(self.urlconf_name, {}, {}, ['']) > > File "/home/crucial/crucial-stack/crucial/urls.py", line 39, in > <module> > admin.autodiscover() > > File > "/usr/lib/python2.5/site-packages/django/contrib/admin/__init__.py", > line 40, in autodiscover > __import__("%s.admin" % app) > > File "/home/crucial/crucial-stack/crucial/website/admin.py", line 3, > in <module> > from crucial.website.models import * > > File > "/home/crucial/crucial-stack/crucial/../crucial/website/models.py", > line 113, in <module> > permissions.register() > > AttributeError: 'module' object has no attribute 'register'
Errors like that tend to appear only the first time the code is executed in a particular process. After that, the module is already imported, so it isn't re-imported and so the code isn't re-executed. You should definitely pay attention to errors that seem to appear only once like that. Firstly, test it out locally. Hopefully you've already done that. Then you have to try and work out what's different about your local system compared to where the problem is occurring. Secondly, you can verify that the problem only occurs the first time by setting the maximum number of requests to 1, so that it's always restarting. Of course, this won't be very exciting performance-wise, so do it on a staging system or when you can afford to have some downtime. > > > It looks like this is the first time urls.py is being loaded, right ? > Is this a process starting up ? > > > I get the following once every few days. > > NoReverseMatch: Reverse for 'crucial.default_rss' with arguments '()' > and keyword arguments '{}' not found. > > I always use named urls {% url default_rss %} > > That its searching for 'crucial.default_rss' is some kind of clue. No, it's not really. The error message reported there is a bit bogus. I'm in the process of fixing that. It just happens that the last thing the resolving tries is to see if things live under the "project name" namespace. That's almost never the case in production environments (since the Python path will have been set explicitly, so the project name has no special meaning), but only one error is reported. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---