python - How to integrate celery with Django, when settings needs to be injected in? -


I am working on a new project where every developer has his own settings file.

Run Django I have such load it:

  python manage.py runserver --settings = "databank_web.settings.dqs.dev_houman"  

I now have to integrate celery 3.1 in the project and this approach is causing me a lot of headache.

I followed the steps to integrate the celery in all Django described as

I can run Django as usual, but now I do this

  DJANGO_SETTINGS_MODULE = 'databank_web.settings.dqs.dev_houman' celery -a databank_web worker as described -l information to run celery with your custom Django environment  

It seems to be one step ahead, but I get this error message:

  file "/ uso The actors / houman / Git / venv / lib / to Python2 .7 / site-packages / django / contrib / admin / sites.py ", line 3, & lt; Module & gt; Django.contrib.admin Import From ModelAdmin, ImportError Functions: Can not Import Name Action  

I did some research and arranged to abbreviate it followed:

  import os os.environ.setdefault django.contrib.admin import ModelAdmin ( "DJANGO_SETTINGS_MODULE", "databank_web.settings.dqs.dev_houman"), action  

to make it clear Was throwing the error, though it seems to work just fine. So I do not know why this fails within the Django environment.

So why am I getting them ImportError: Can not Import Name Action Errors

Highly appreciated

It looks more like a circular dependency.

If you follow the guide, you should have created a new file called celery py .

celery.py

 by default django.conf import settings # celery import celery __future__ import absolute_import import OS  set in Django settings celery program modules os.environ.setdefault ( 'DJANGO_SETTINGS_MODULE', 'proj.settings') app = celery ( 'proj') app.config_from_object ( 'django.conf for setting') app.autodiscover_tasks (lambda: settings. INSTALLED_APPS)  

outside os.environ.setdefault ( 'DJANGO_SETTINGS_MODULE', 'proj.settings') whatever to comment because the overwrite you scope Trying to pass out Is obtained.

Then, set the DJANGO_SETTINGS_MODULE variable outside the file.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -