mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-07-11 00:22:29 +03:00
Config celery app immediately after the app being created, otherwise it is too late.
This commit is contained in:
parent
a6117de501
commit
8217ea439b
|
@ -121,6 +121,7 @@ Listed in alphabetical order.
|
||||||
Krzysztof Szumny `@noisy`_
|
Krzysztof Szumny `@noisy`_
|
||||||
Krzysztof Żuraw `@krzysztofzuraw`_
|
Krzysztof Żuraw `@krzysztofzuraw`_
|
||||||
Leonardo Jimenez `@xpostudio4`_
|
Leonardo Jimenez `@xpostudio4`_
|
||||||
|
Leo Zhou `@glasslion`_
|
||||||
Lin Xianyi `@iynaix`_
|
Lin Xianyi `@iynaix`_
|
||||||
Luis Nell `@originell`_
|
Luis Nell `@originell`_
|
||||||
Lukas Klein
|
Lukas Klein
|
||||||
|
@ -217,6 +218,7 @@ Listed in alphabetical order.
|
||||||
.. _@garry-cairns: https://github.com/garry-cairns
|
.. _@garry-cairns: https://github.com/garry-cairns
|
||||||
.. _@garrypolley: https://github.com/garrypolley
|
.. _@garrypolley: https://github.com/garrypolley
|
||||||
.. _@goldhand: https://github.com/goldhand
|
.. _@goldhand: https://github.com/goldhand
|
||||||
|
.. _@glasslion: https://github.com/glasslion
|
||||||
.. _@hackebrot: https://github.com/hackebrot
|
.. _@hackebrot: https://github.com/hackebrot
|
||||||
.. _@hairychris: https://github.com/hairychris
|
.. _@hairychris: https://github.com/hairychris
|
||||||
.. _@hendrikschneider: https://github.com/hendrikschneider
|
.. _@hendrikschneider: https://github.com/hendrikschneider
|
||||||
|
|
|
@ -11,6 +11,11 @@ if not settings.configured:
|
||||||
|
|
||||||
|
|
||||||
app = Celery('{{cookiecutter.project_slug}}')
|
app = Celery('{{cookiecutter.project_slug}}')
|
||||||
|
# Using a string here means the worker will not have to
|
||||||
|
# pickle the object when using Windows.
|
||||||
|
# - namespace='CELERY' means all celery-related configuration keys
|
||||||
|
# should have a `CELERY_` prefix.
|
||||||
|
app.config_from_object('django.conf:settings', namespace='CELERY')
|
||||||
|
|
||||||
|
|
||||||
class CeleryAppConfig(AppConfig):
|
class CeleryAppConfig(AppConfig):
|
||||||
|
@ -18,11 +23,6 @@ class CeleryAppConfig(AppConfig):
|
||||||
verbose_name = 'Celery Config'
|
verbose_name = 'Celery Config'
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
# Using a string here means the worker will not have to
|
|
||||||
# pickle the object when using Windows.
|
|
||||||
# - namespace='CELERY' means all celery-related configuration keys
|
|
||||||
# should have a `CELERY_` prefix.
|
|
||||||
app.config_from_object('django.conf:settings', namespace='CELERY')
|
|
||||||
installed_apps = [app_config.name for app_config in apps.get_app_configs()]
|
installed_apps = [app_config.name for app_config in apps.get_app_configs()]
|
||||||
app.autodiscover_tasks(lambda: installed_apps, force=True)
|
app.autodiscover_tasks(lambda: installed_apps, force=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user