mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-26 03:24:01 +03:00
parent
5543359382
commit
03ee6c78d6
|
@ -249,6 +249,11 @@ 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 main():
|
||||
postgres_user = generate_postgres_user()
|
||||
set_flags_in_envs(postgres_user)
|
||||
|
@ -311,6 +316,8 @@ def main():
|
|||
|
||||
if '{{ cookiecutter.use_celery }}'.lower() == 'n':
|
||||
remove_celery_app()
|
||||
if '{{ cookiecutter.use_docker }}'.lower() == 'y':
|
||||
remove_celery_envs()
|
||||
|
||||
if '{{ cookiecutter.use_travisci }}'.lower() == 'n':
|
||||
remove_dottravisyml_file()
|
||||
|
|
3
{{cookiecutter.project_slug}}/.envs/.local/.celery
Normal file
3
{{cookiecutter.project_slug}}/.envs/.local/.celery
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Celery
|
||||
# ------------------------------------------------------------------------------
|
||||
CELERY_BROKER_URL=redis://redis:6379/0
|
3
{{cookiecutter.project_slug}}/.envs/.production/.celery
Normal file
3
{{cookiecutter.project_slug}}/.envs/.production/.celery
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Celery
|
||||
# ------------------------------------------------------------------------------
|
||||
CELERY_BROKER_URL=redis://redis:6379/0
|
|
@ -7,11 +7,6 @@ set -o nounset
|
|||
|
||||
cmd="$@"
|
||||
|
||||
export REDIS_URL=redis://redis:6379
|
||||
{%- if cookiecutter.use_celery == 'y' %}
|
||||
export CELERY_BROKER_URL="${REDIS_URL}/0"
|
||||
{%- endif %}
|
||||
|
||||
if [ -z "${POSTGRES_USER}" ]; then
|
||||
# the official postgres image uses 'postgres' as default user if not set explictly.
|
||||
export POSTGRES_USER=postgres
|
||||
|
|
|
@ -11,7 +11,7 @@ services:
|
|||
dockerfile: ./compose/local/django/Dockerfile
|
||||
depends_on:
|
||||
- postgres
|
||||
{% if cookiecutter.use_mailhog == 'y' -%}
|
||||
{%- if cookiecutter.use_mailhog == 'y' %}
|
||||
- mailhog
|
||||
{%- endif %}
|
||||
volumes:
|
||||
|
@ -19,6 +19,9 @@ services:
|
|||
env_file:
|
||||
- ./.envs/.local/.django
|
||||
- ./.envs/.local/.postgres
|
||||
{%- if cookiecutter.use_celery == 'y' %}
|
||||
- ./.envs/.local/.celery
|
||||
{%- endif %}
|
||||
ports:
|
||||
- "8000:8000"
|
||||
command: /start.sh
|
||||
|
@ -32,12 +35,16 @@ services:
|
|||
- postgres_backup_local:/backups
|
||||
env_file:
|
||||
- ./.envs/.local/.postgres
|
||||
{% if cookiecutter.use_mailhog == 'y' %}
|
||||
{%- if cookiecutter.use_mailhog == 'y' %}
|
||||
|
||||
mailhog:
|
||||
image: mailhog/mailhog:v1.0.0
|
||||
ports:
|
||||
- "8025:8025"
|
||||
{% endif %}{% if cookiecutter.use_celery == 'y' %}
|
||||
|
||||
{%- endif %}
|
||||
{%- if cookiecutter.use_celery == 'y' %}
|
||||
|
||||
redis:
|
||||
image: redis:3.0
|
||||
|
||||
|
@ -49,6 +56,8 @@ services:
|
|||
{% if cookiecutter.use_mailhog == 'y' -%}
|
||||
- mailhog
|
||||
{%- endif %}
|
||||
env_file:
|
||||
- ./.envs/.local/.celery
|
||||
ports: []
|
||||
command: /start-celeryworker.sh
|
||||
|
||||
|
@ -60,6 +69,9 @@ services:
|
|||
{% if cookiecutter.use_mailhog == 'y' -%}
|
||||
- mailhog
|
||||
{%- endif %}
|
||||
env_file:
|
||||
- ./.envs/.local/.celery
|
||||
ports: []
|
||||
command: /start-celerybeat.sh
|
||||
{% endif %}
|
||||
|
||||
{%- endif %}
|
||||
|
|
|
@ -8,6 +8,9 @@ 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')
|
||||
|
|
|
@ -16,6 +16,9 @@ services:
|
|||
env_file:
|
||||
- ./.envs/.production/.django
|
||||
- ./.envs/.production/.postgres
|
||||
{%- if cookiecutter.use_celery == 'y' %}
|
||||
- ./.envs/.production/.celery
|
||||
{%- endif %}
|
||||
command: /gunicorn.sh
|
||||
|
||||
postgres:
|
||||
|
@ -44,15 +47,15 @@ services:
|
|||
|
||||
redis:
|
||||
image: redis:3.0
|
||||
{% if cookiecutter.use_celery == 'y' %}
|
||||
{%- if cookiecutter.use_celery == 'y' %}
|
||||
|
||||
celeryworker:
|
||||
<<: *django
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
env_file:
|
||||
- ./.envs/.production/.django
|
||||
- ./.envs/.production/.postgres
|
||||
- ./.envs/.production/.celery
|
||||
command: /start-celeryworker.sh
|
||||
|
||||
celerybeat:
|
||||
|
@ -61,7 +64,7 @@ services:
|
|||
- postgres
|
||||
- redis
|
||||
env_file:
|
||||
- ./.envs/.production/.django
|
||||
- ./.envs/.production/.postgres
|
||||
- ./.envs/.production/.celery
|
||||
command: /start-celerybeat.sh
|
||||
{% endif %}
|
||||
|
||||
{%- endif %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user