django - raise ImportError("Settings cannot be imported, because environment variable %s is undefined -
there several questions here on stack regarding error, no answer has helped me , strange thing error raised while has worked fine before.
what did restart server, , turned up:
how come error can turn while haven't changed , how can fix it?
traceback (most recent call last): file "/library/frameworks/python.framework/versions/2.7/bin/django-admin.py", line 5, in <module> management.execute_from_command_line() file "/library/python/2.7/site-packages/django-1.4.5-py2.7.egg/django/core/management/__init__.py", line 443, in execute_from_command_line utility.execute() file "/library/python/2.7/site-packages/django-1.4.5-py2.7.egg/django/core/management/__init__.py", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "/library/python/2.7/site-packages/django-1.4.5-py2.7.egg/django/core/management/__init__.py", line 261, in fetch_command klass = load_command_class(app_name, subcommand) file "/library/python/2.7/site-packages/django-1.4.5-py2.7.egg/django/core/management/__init__.py", line 69, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) file "/library/python/2.7/site-packages/django-1.4.5-py2.7.egg/django/utils/importlib.py", line 35, in import_module __import__(name) file "/library/python/2.7/site-packages/django-1.4.5-py2.7.egg/django/core/management/commands/runserver.py", line 8, in <module> django.core.servers.basehttp import adminmediahandler, run, wsgiserverexception, get_internal_wsgi_application file "/library/python/2.7/site-packages/django-1.4.5-py2.7.egg/django/core/servers/basehttp.py", line 26, in <module> django.views import static file "/library/python/2.7/site-packages/django-1.4.5-py2.7.egg/django/views/static.py", line 95, in <module> template_translatable = ugettext_noop(u"index of %(directory)s") file "/library/python/2.7/site-packages/django-1.4.5-py2.7.egg/django/utils/translation/__init__.py", line 75, in gettext_noop return _trans.gettext_noop(message) file "/library/python/2.7/site-packages/django-1.4.5-py2.7.egg/django/utils/translation/__init__.py", line 48, in __getattr__ if settings.use_i18n: file "/library/python/2.7/site-packages/django-1.4.5-py2.7.egg/django/utils/functional.py", line 184, in inner self._setup() file "/library/python/2.7/site-packages/django-1.4.5-py2.7.egg/django/conf/__init__.py", line 40, in _setup raise importerror("settings cannot imported, because environment variable %s undefined." % environment_variable) importerror: settings cannot imported, because environment variable django_settings_module undefined.
i run script whenever open new shell:
export pythonpath=$pythonpath:/users/cole/projects/sites/my_project.com/my_project export django_settings_module=my_project.settings update: had edited script in little sloppily. needed is:
export pythonpath=$pythonpath:/path/to/project/root/directory export django_settings_module=my_project.settings
Comments
Post a Comment