开发者

Internal Server error on the first request (and *only* the first request) after server reload

Each time I do a server reload after updating my Django app (running on httpd, using mod-wsgi), the first request is always an internal error.

The problem is always the same -- the app can't import a given model from another app. Unfortunately ImportError is maybe the least helpful of all exceptions in that it 开发者_开发技巧doesn't tell you why an import failed, only that it did.

Has anyone encountered this problem, and how was it resolved? Right now there is no workaround, since there are models.py files that rely on this other model. Normally I would assume there was an error in the code, but as the request works every other time I'm guessing it's running into problems for some other reason.

Details:

  • Django 1.3
  • running under virtualenv
  • app that is being imported is not part of main project but included via INSTALLED_APPS


I'd say just give a shot to importing that models module in the manage.py script to see if a preload will work. Also keep an eye out for circular imports (modules importing one another).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜