linux - Why does adding export DJANGO_SETTINGS_MODULE='myproject.settings' to bashrc no longer work? -
i have django app running on linux machine (debian). past little while app has run perfectly. needed reboot machine after celery tasks started hang , purging tasks didn't have desired effect. when attempt start celery using
sudo celery -a myapp.tasks worker -ofair
i presented following traceback
traceback (most recent call last): file "/usr/local/bin/celery", line 9, in <module> load_entry_point('celery==3.1.11', 'console_scripts', 'celery')() file "/usr/local/lib/python2.7/dist-packages/celery/__main__.py", line 30, in main main() file "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 81, in main cmd.execute_from_commandline(argv) file "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 769, in execute_from_commandline super(celerycommand, self).execute_from_commandline(argv))) file "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 304, in execute_from_commandline argv = self.setup_app_from_commandline(argv) file "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 464, in setup_app_from_commandline self.app = self.find_app(app) file "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 484, in find_app return find_app(app, symbol_by_name=self.symbol_by_name) file "/usr/local/lib/python2.7/dist-packages/celery/app/utils.py", line 225, in find_app sym = imp(app) file "/usr/local/lib/python2.7/dist-packages/celery/utils/imports.py", line 101, in import_from_cwd return imp(module, package=package) file "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) file "/home/this/gce_app/myapp/tasks.py", line 8, in <module> django.views.decorators.csrf import csrf_exempt file "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 1, in <module> django.middleware.csrf import csrfviewmiddleware, get_token file "/usr/local/lib/python2.7/dist-packages/django/middleware/csrf.py", line 14, in <module> django.utils.cache import patch_vary_headers file "/usr/local/lib/python2.7/dist-packages/django/utils/cache.py", line 26, in <module> django.core.cache import get_cache file "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 69, in <module> if default_cache_alias not in settings.caches: file "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 54, in __getattr__ self._setup(name) file "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 47, in _setup % (desc, environment_variable)) django.core.exceptions.improperlyconfigured: requested setting caches, settings not configured. must either define environment variable django_settings_module or call settings.configure() before accessing set tings.
i have added export bashrc (at end) fixed problem in past, still presented same error:
sudo nano ~/.bashrc export django_settings_module='myproject.settings'
is there way working again?
you're starting celery sudo, means you're running root user, not 1 set environment variable for. don't - there's absolutely no reason run daemon sudo.
(and not related problem, shouldn't editing bashrc sudo either.)
Comments
Post a Comment