Geslot
Geslot

Reputation: 23

Django: Celery import causes error while executing cron commands

Recently installed celery on django, it works fine, but I realized that my cron (I mean usual cron, not celery's periodic tasks) commands doesn't execute. I had lines in my cron like this:

sudo -u someuser python /home/someuser/django_proj/manage.py somecommand --settings=someapp.settings

And it works very well. But if I add "import djcelery" to settings.py, I will have this error:

Unknown command: 'somecommand'
Type 'manage.py help' for usage.

What am I doing wrong? P.S. I know, that celery has periodic tasks, but I can't use this feature right now.

Also, I have "common_settings.py" file, and someapp/settings.py has this code:

from common_settings import *

If I add "import djcelery" to common_settings.py I will got this:

Error: Can't find the file 'settings.py' in the directory containing '/home/someuser/django_proj/manage.py'. It appears you've customized things. You'll have to run django-admin.py, passing it your settings module. (If the file settings.py does indeed exist, it's causing an ImportError somehow.)

It tries to find settings in django_proj folder, but I don't have any settings here.

Upvotes: 0

Views: 278

Answers (1)

Rustem
Rustem

Reputation: 2932

Looks, like you're not installed your application correctly. For example you may forgot comma in INSTALLED_APPS, and your previous application is not activating when django starts. No any reasons to get it broken.

Upvotes: 0

Related Questions