diff --git a/.github/ISSUE_TEMPLATE/paid-support.md b/.github/ISSUE_TEMPLATE/paid-support.md index 7cd2c4a57..d565e564f 100644 --- a/.github/ISSUE_TEMPLATE/paid-support.md +++ b/.github/ISSUE_TEMPLATE/paid-support.md @@ -7,4 +7,4 @@ Provided your question goes beyound [regular support](https://github.com/pydanny * Daniel Roy Greenfeld, Project Lead ([GitHub](https://github.com/pydanny), [Patreon](https://www.patreon.com/danielroygreenfeld)): expertise in Django and AWS ELB. -* Nikita Shupeyko, Core Developer ([GitHub](https://github.com/webyneter)): expertise in Django, Docker, and Heroku. +* Nikita Shupeyko, Core Developer ([GitHub](https://github.com/webyneter)): expertise in Python/Django, hands-on DevOps and frontend experience. diff --git a/.gitignore b/.gitignore index 9e4496f1c..54fafb8be 100644 --- a/.gitignore +++ b/.gitignore @@ -215,7 +215,6 @@ tags [Ii]nclude [Ll]ib [Ll]ib64 -[Ll]ocal [Ss]cripts pyvenv.cfg pip-selfcheck.json diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 0f6761ed5..55ae6d722 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -87,6 +87,7 @@ Listed in alphabetical order. David Díaz `@ddiazpinto`_ @DavidDiazPinto Davur Clementsen `@dsclementsen`_ @davur Delio Castillo `@jangeador`_ @jangeador + Denis Orehovsky `@apirobot`_ Dónal Adams `@epileptic-fish`_ Dong Huynh `@trungdong`_ Emanuel Calso `@bloodpet`_ @bloodpet @@ -172,6 +173,7 @@ Listed in alphabetical order. .. _@amjith: https://github.com/amjith .. _@andor-pierdelacabeza: https://github.com/andor-pierdelacabeza .. _@antoniablair: https://github.com/antoniablair +.. _@apirobot: https://github.com/apirobot .. _@archinal: https://github.com/archinal .. _@areski: https://github.com/areski .. _@arruda: https://github.com/arruda diff --git a/README.rst b/README.rst index 7e24a8369..0eaea5194 100644 --- a/README.rst +++ b/README.rst @@ -98,7 +98,9 @@ Support this Project! This project is run by volunteers. Please support them in their efforts to maintain and improve Cookiecutter Django: -* https://www.patreon.com/danielroygreenfeld: Project lead. Expertise in AWS ELB and Django. +* Daniel Roy Greenfeld, Project Lead (`GitHub `_, `Patreon `_): expertise in Django and AWS ELB. + +* Nikita Shupeyko, Core Developer (`GitHub `_): expertise in Python/Django, hands-on DevOps and frontend experience. Projects that provide financial support to the maintainers: diff --git a/requirements.txt b/requirements.txt index 9f378fdaa..77770fa9e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,5 +9,5 @@ flake8==3.5.0 # Testing # ------------------------------------------------------------------------------ tox==3.0.0 -pytest==3.6.1 +pytest==3.6.2 pytest-cookies==0.3.0 diff --git a/{{cookiecutter.project_slug}}/.gitignore b/{{cookiecutter.project_slug}}/.gitignore index c6273596b..679fb9026 100644 --- a/{{cookiecutter.project_slug}}/.gitignore +++ b/{{cookiecutter.project_slug}}/.gitignore @@ -330,7 +330,6 @@ tags [Ii]nclude [Ll]ib [Ll]ib64 -[Ll]ocal [Ss]cripts pyvenv.cfg pip-selfcheck.json diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py index 26bbd479a..e4ab28844 100644 --- a/{{cookiecutter.project_slug}}/config/settings/base.py +++ b/{{cookiecutter.project_slug}}/config/settings/base.py @@ -229,19 +229,25 @@ MANAGERS = ADMINS # Celery # ------------------------------------------------------------------------------ INSTALLED_APPS += ['{{cookiecutter.project_slug}}.taskapp.celery.CeleryAppConfig'] +if USE_TZ: + # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-timezone + CELERY_TIMEZONE = TIME_ZONE # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-broker_url -CELERY_BROKER_URL = env('CELERY_BROKER_URL', default='django://') +CELERY_BROKER_URL = env('CELERY_BROKER_URL') # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-result_backend -if CELERY_BROKER_URL == 'django://': - CELERY_RESULT_BACKEND = 'redis://' -else: - CELERY_RESULT_BACKEND = CELERY_BROKER_URL +CELERY_RESULT_BACKEND = CELERY_BROKER_URL # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-accept_content CELERY_ACCEPT_CONTENT = ['json'] # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-task_serializer CELERY_TASK_SERIALIZER = 'json' # http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-result_serializer CELERY_RESULT_SERIALIZER = 'json' +# http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-time-limit +# TODO: set to whatever value is adequate in your circumstances +CELERYD_TASK_TIME_LIMIT = 5 * 60 +# http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-soft-time-limit +# TODO: set to whatever value is adequate in your circumstances +CELERYD_TASK_SOFT_TIME_LIMIT = 60 {%- endif %} # django-allauth diff --git a/{{cookiecutter.project_slug}}/config/settings/local.py b/{{cookiecutter.project_slug}}/config/settings/local.py index ac11eda56..741f324af 100644 --- a/{{cookiecutter.project_slug}}/config/settings/local.py +++ b/{{cookiecutter.project_slug}}/config/settings/local.py @@ -76,8 +76,10 @@ INSTALLED_APPS += ['django_extensions'] # noqa F405 # Celery # ------------------------------------------------------------------------------ -# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-task_always_eager -CELERY_ALWAYS_EAGER = True +# http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-always-eager +CELERY_TASK_ALWAYS_EAGER = True +# http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-eager-propagates +CELERY_TASK_EAGER_PROPAGATES = True {%- endif %} # Your stuff... diff --git a/{{cookiecutter.project_slug}}/requirements/base.txt b/{{cookiecutter.project_slug}}/requirements/base.txt index 6b2ec4b55..5e8f78468 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.txt +++ b/{{cookiecutter.project_slug}}/requirements/base.txt @@ -10,7 +10,7 @@ whitenoise==3.3.1 # https://github.com/evansd/whitenoise {%- endif %} redis>=2.10.5 # https://github.com/antirez/redis {%- if cookiecutter.use_celery == "y" %} -celery==3.1.25 # pyup: <4.0 # https://github.com/celery/celery +celery==4.2.0 # pyup: <5.0 # https://github.com/celery/celery {%- endif %} # Django diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 83e8846c8..63799d990 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -6,12 +6,12 @@ Sphinx==1.7.5 # https://github.com/sphinx-doc/sphinx {%- if cookiecutter.use_docker == 'y' %} psycopg2==2.7.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2 {%- else %} -psycopg2-binary==2.7.4 # https://github.com/psycopg/psycopg2 +psycopg2-binary==2.7.5 # https://github.com/psycopg/psycopg2 {%- endif %} # Testing # ------------------------------------------------------------------------------ -pytest==3.6.1 # https://github.com/pytest-dev/pytest +pytest==3.6.2 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.1 # https://github.com/Frozenball/pytest-sugar # Code quality @@ -26,4 +26,4 @@ factory-boy==2.11.1 # https://github.com/FactoryBoy/factory_boy django-debug-toolbar==1.9.1 # https://github.com/jazzband/django-debug-toolbar django-extensions==2.0.7 # https://github.com/django-extensions/django-extensions django-coverage-plugin==1.5.0 # https://github.com/nedbat/django_coverage_plugin -pytest-django==3.2.1 # https://github.com/pytest-dev/pytest-django +pytest-django==3.3.2 # https://github.com/pytest-dev/pytest-django diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py index ed5c71760..b3f0a388b 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py @@ -20,7 +20,9 @@ class CeleryAppConfig(AppConfig): def ready(self): # Using a string here means the worker will not have to # pickle the object when using Windows. - app.config_from_object('django.conf:settings') + # - 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()] app.autodiscover_tasks(lambda: installed_apps, force=True)