Reputation: 2827
I'm trying to find out how to import models in my tasks.py in celery.
In the moment my project structure is the following:
/mainApp
-celery_instance
-__init.py__
-celery.py
-tasks.py
-app
-settings.py
-urls.py
-models.py
-admin
-__init.py__
-views.py
What I try is to write a task to check each day if there is a birthday.
Do I need to import models in tasks.py? I tried it, but I get an error. It doesn't recognize my models. From mainApp I can only import settings.py.
Any help would be appreciated.
Thanks.
Upvotes: 1
Views: 989
Reputation: 2827
It seems it was an error with my django-celery version.
I found the solution adding in my settings.py
CELERY_IMPORTS = ('celery_instance.tasks',)
Upvotes: 1