On 29.10.2008 12:49 Uhr, Benjamin Buch wrote: > The thing is, I don't want to tie the comments signals to a specific > application. > It's more of a project-wide thing. > > So I did put the code into signals.py, stuffed it into my project root > (not in an app) > and imported it in my project's __init__.py. > > Now I get this Error if I try to ./manage.py runserver: > > Traceback (most recent call last): > File "./manage.py", line 11, in<module> > execute_manager(settings) > File "/Library/Python/2.5/site-packages/django/core/management/ > __init__.py", line 338, in execute_manager > setup_environ(settings_mod) > File "/Library/Python/2.5/site-packages/django/core/management/ > __init__.py", line 316, in setup_environ > project_module = __import__(project_name, {}, {}, ['']) > File "/Users/benjamin/Code/django/kassette/../kassette/ > __init__.py", line 1, in<module> > import signals.py > File "/Users/benjamin/Code/django/kassette/../kassette/signals.py", > line 1, in<module> > from django.contrib.comments.models import Comment > File "/Library/Python/2.5/site-packages/django/contrib/comments/ > models.py", line 2, in<module> > from django.contrib.auth.models import User > File "/Library/Python/2.5/site-packages/django/contrib/auth/ > models.py", line 6, in<module> > from django.db import models > File "/Library/Python/2.5/site-packages/django/db/__init__.py", > line 9, in<module> > if not settings.DATABASE_ENGINE: > File "/Library/Python/2.5/site-packages/django/conf/__init__.py", > line 28, in __getattr__ > self._import_settings() > File "/Library/Python/2.5/site-packages/django/conf/__init__.py", > line 57, in _import_settings > raise ImportError("Settings cannot be imported, because > environment variable %s is undefined." % ENVIRONMENT_VARIABLE) > ImportError: Settings cannot be imported, because environment variable > DJANGO_SETTINGS_MODULE is undefined. > > Why do I have to set an environment variable for this? > Django never complained about this before. > > you can't put it in the projects __init__.py since that is imported before django can initialize itself.
I sometimes just create a module named core in the project directory and place stuf I need in various place there. how about creating an app called global put the signals.py in there and in the __init__.py do an import signals. > @adi: > What do you mean by 'whatever pleases you'? > naja, es ist egal wohin du die signals tust so lange es für dich passt und es im Rahmen der Django Vorgaben bleibt. adi -- Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 Freelance developer web: http://www.sieker.info/profile SAP-Developer --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---