diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 2ad936a9..050a0ca4 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -249,11 +249,6 @@ def remove_envs_and_associated_files(): os.remove('merge_production_dotenvs_in_dotenv.py') -def remove_celery_envs(): - os.remove(os.path.join('.envs', '.local', '.celery')) - os.remove(os.path.join('.envs', '.production', '.celery')) - - def remove_celery_compose_dirs(): shutil.rmtree(os.path.join('compose', 'local', 'django', 'celery')) shutil.rmtree(os.path.join('compose', 'production', 'django', 'celery')) @@ -322,7 +317,6 @@ def main(): if '{{ cookiecutter.use_celery }}'.lower() == 'n': remove_celery_app() if '{{ cookiecutter.use_docker }}'.lower() == 'y': - remove_celery_envs() remove_celery_compose_dirs() if '{{ cookiecutter.use_travisci }}'.lower() == 'n': diff --git a/{{cookiecutter.project_slug}}/.envs/.local/.celery b/{{cookiecutter.project_slug}}/.envs/.local/.celery deleted file mode 100644 index f779a430..00000000 --- a/{{cookiecutter.project_slug}}/.envs/.local/.celery +++ /dev/null @@ -1,3 +0,0 @@ -# Celery -# ------------------------------------------------------------------------------ -CELERY_BROKER_URL=redis://redis:6379/0 diff --git a/{{cookiecutter.project_slug}}/.envs/.local/.django b/{{cookiecutter.project_slug}}/.envs/.local/.django index 630aa890..e0d21567 100644 --- a/{{cookiecutter.project_slug}}/.envs/.local/.django +++ b/{{cookiecutter.project_slug}}/.envs/.local/.django @@ -1,3 +1,8 @@ # General # ------------------------------------------------------------------------------ USE_DOCKER=yes +{% if cookiecutter.use_celery == "y" %} +# Celery +# ------------------------------------------------------------------------------ +CELERY_BROKER_URL=redis://redis:6379/0 +{% endif %} diff --git a/{{cookiecutter.project_slug}}/.envs/.production/.celery b/{{cookiecutter.project_slug}}/.envs/.production/.celery deleted file mode 100644 index f779a430..00000000 --- a/{{cookiecutter.project_slug}}/.envs/.production/.celery +++ /dev/null @@ -1,3 +0,0 @@ -# Celery -# ------------------------------------------------------------------------------ -CELERY_BROKER_URL=redis://redis:6379/0 diff --git a/{{cookiecutter.project_slug}}/.envs/.production/.django b/{{cookiecutter.project_slug}}/.envs/.production/.django index 284a3488..934d03db 100644 --- a/{{cookiecutter.project_slug}}/.envs/.production/.django +++ b/{{cookiecutter.project_slug}}/.envs/.production/.django @@ -16,7 +16,11 @@ DJANGO_SECURE_SSL_REDIRECT=False MAILGUN_API_KEY= DJANGO_SERVER_EMAIL= MAILGUN_DOMAIN= - +{% if cookiecutter.use_celery == "y" %} +# Celery +# ------------------------------------------------------------------------------ +CELERY_BROKER_URL=redis://redis:6379/0 +{% endif %} # AWS # ------------------------------------------------------------------------------ DJANGO_AWS_ACCESS_KEY_ID= diff --git a/{{cookiecutter.project_slug}}/local.yml b/{{cookiecutter.project_slug}}/local.yml index 3222ec12..09e065dd 100644 --- a/{{cookiecutter.project_slug}}/local.yml +++ b/{{cookiecutter.project_slug}}/local.yml @@ -19,9 +19,6 @@ services: env_file: - ./.envs/.local/.django - ./.envs/.local/.postgres - {%- if cookiecutter.use_celery == 'y' %} - - ./.envs/.local/.celery - {%- endif %} ports: - "8000:8000" command: /start.sh @@ -57,7 +54,7 @@ services: - mailhog {%- endif %} env_file: - - ./.envs/.local/.celery + - ./.envs/.local/.django - ./.envs/.local/.postgres ports: [] command: /start-celeryworker.sh @@ -71,7 +68,7 @@ services: - mailhog {%- endif %} env_file: - - ./.envs/.local/.celery + - ./.envs/.local/.django - ./.envs/.local/.postgres ports: [] command: /start-celerybeat.sh diff --git a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py index fe4560ad..c1bfe30a 100644 --- a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py +++ b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py @@ -8,9 +8,6 @@ PRODUCTION_DOTENVS_DIR_PATH = os.path.join(ROOT_DIR_PATH, '.envs', '.production' PRODUCTION_DOTENV_FILE_PATHS = [ os.path.join(PRODUCTION_DOTENVS_DIR_PATH, '.django'), os.path.join(PRODUCTION_DOTENVS_DIR_PATH, '.postgres'), - {%- if cookiecutter.use_celery == 'y' %} - os.path.join(PRODUCTION_DOTENVS_DIR_PATH, '.celery'), - {%- endif %} os.path.join(PRODUCTION_DOTENVS_DIR_PATH, '.caddy'), ] DOTENV_FILE_PATH = os.path.join(ROOT_DIR_PATH, '.env') diff --git a/{{cookiecutter.project_slug}}/production.yml b/{{cookiecutter.project_slug}}/production.yml index 1581bea0..b36c5e1f 100644 --- a/{{cookiecutter.project_slug}}/production.yml +++ b/{{cookiecutter.project_slug}}/production.yml @@ -16,9 +16,6 @@ services: env_file: - ./.envs/.production/.django - ./.envs/.production/.postgres - {%- if cookiecutter.use_celery == 'y' %} - - ./.envs/.production/.celery - {%- endif %} command: /gunicorn.sh postgres: @@ -55,7 +52,7 @@ services: - postgres - redis env_file: - - ./.envs/.production/.celery + - ./.envs/.production/.django - ./.envs/.production/.postgres command: /start-celeryworker.sh @@ -65,7 +62,7 @@ services: - postgres - redis env_file: - - ./.envs/.production/.celery + - ./.envs/.production/.django - ./.envs/.production/.postgres command: /start-celerybeat.sh