On Tue, Aug 2, 2011 at 12:38 PM, Tom Evans <tevans.uk@googlemail.com> wrote:
Django doesn't do anything differently, AFAIK (happy to be corrected).On Tue, Aug 2, 2011 at 3:17 PM, George Cummins <george@8people.com> wrote:
> While testing changes to an existing project, I disabled debugging. While
> trying to restart the web server (uWSGI+nginix), I encountered the following
> error:
>
> File "/opt/django-projects/preps/statistics/models.py", line 5, in <module>
>
> from preps.games.models import FootballGame, VolleyballGame,
> GirlsBasketballGame, BoysBasketballGame, BaseballGame, SoftballGame
>
> ImportError: cannot import name VolleyballGame
>
> (Full traceback here: http://pastebin.com/AqzjTuLz)
> This error does not occur when DEBUG=True, and does not occur when using
> Django's runserver whether debugging is on or off. It only occurs when using
> my production stack ( Django 1.2.5+uWSGI+nginx ).
> I have checked and rechecked the code, and can find no problems. Can you
> tell me the differences in the way Django handles imports when debugging is
> on or off, or point to relevant documentation?
> Thank you,
> George Cummins
>
However, this doesn't necessarily mean that there cannot be a
difference. For instance, if prep/games/models.py started like this:
from django.conf import settings
if not settings.DEBUG:
from django import no_such_module
then attempting to import a model from that file would fail if
settings.DEBUG is off. Obviously this is a contrived example, but
could something like this be affecting you?
Cheers
Tom
Thank you for the tip. I have verified that no custom code is executing based on the debug state.
In other places online, there are mentions of circular references causing this type of problem.
I believe I have ruled out circular references as a problem, but the fact that they are known
and ignored when debugging is enabled led me to believe there must be a difference in the
load processes between debugging and non-debugging.
Any other ideas would be greatly appreciated.
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment