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')
|
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():
|
def main():
|
||||||
postgres_user = generate_postgres_user()
|
postgres_user = generate_postgres_user()
|
||||||
set_flags_in_envs(postgres_user)
|
set_flags_in_envs(postgres_user)
|
||||||
|
@ -311,6 +316,8 @@ def main():
|
||||||
|
|
||||||
if '{{ cookiecutter.use_celery }}'.lower() == 'n':
|
if '{{ cookiecutter.use_celery }}'.lower() == 'n':
|
||||||
remove_celery_app()
|
remove_celery_app()
|
||||||
|
if '{{ cookiecutter.use_docker }}'.lower() == 'y':
|
||||||
|
remove_celery_envs()
|
||||||
|
|
||||||
if '{{ cookiecutter.use_travisci }}'.lower() == 'n':
|
if '{{ cookiecutter.use_travisci }}'.lower() == 'n':
|
||||||
remove_dottravisyml_file()
|
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="$@"
|
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
|
if [ -z "${POSTGRES_USER}" ]; then
|
||||||
# the official postgres image uses 'postgres' as default user if not set explictly.
|
# the official postgres image uses 'postgres' as default user if not set explictly.
|
||||||
export POSTGRES_USER=postgres
|
export POSTGRES_USER=postgres
|
||||||
|
|
|
@ -11,7 +11,7 @@ services:
|
||||||
dockerfile: ./compose/local/django/Dockerfile
|
dockerfile: ./compose/local/django/Dockerfile
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
{% if cookiecutter.use_mailhog == 'y' -%}
|
{%- if cookiecutter.use_mailhog == 'y' %}
|
||||||
- mailhog
|
- mailhog
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -19,6 +19,9 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- ./.envs/.local/.django
|
- ./.envs/.local/.django
|
||||||
- ./.envs/.local/.postgres
|
- ./.envs/.local/.postgres
|
||||||
|
{%- if cookiecutter.use_celery == 'y' %}
|
||||||
|
- ./.envs/.local/.celery
|
||||||
|
{%- endif %}
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
command: /start.sh
|
command: /start.sh
|
||||||
|
@ -32,12 +35,16 @@ services:
|
||||||
- postgres_backup_local:/backups
|
- postgres_backup_local:/backups
|
||||||
env_file:
|
env_file:
|
||||||
- ./.envs/.local/.postgres
|
- ./.envs/.local/.postgres
|
||||||
{% if cookiecutter.use_mailhog == 'y' %}
|
{%- if cookiecutter.use_mailhog == 'y' %}
|
||||||
|
|
||||||
mailhog:
|
mailhog:
|
||||||
image: mailhog/mailhog:v1.0.0
|
image: mailhog/mailhog:v1.0.0
|
||||||
ports:
|
ports:
|
||||||
- "8025:8025"
|
- "8025:8025"
|
||||||
{% endif %}{% if cookiecutter.use_celery == 'y' %}
|
|
||||||
|
{%- endif %}
|
||||||
|
{%- if cookiecutter.use_celery == 'y' %}
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:3.0
|
image: redis:3.0
|
||||||
|
|
||||||
|
@ -49,6 +56,8 @@ services:
|
||||||
{% if cookiecutter.use_mailhog == 'y' -%}
|
{% if cookiecutter.use_mailhog == 'y' -%}
|
||||||
- mailhog
|
- mailhog
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
env_file:
|
||||||
|
- ./.envs/.local/.celery
|
||||||
ports: []
|
ports: []
|
||||||
command: /start-celeryworker.sh
|
command: /start-celeryworker.sh
|
||||||
|
|
||||||
|
@ -60,6 +69,9 @@ services:
|
||||||
{% if cookiecutter.use_mailhog == 'y' -%}
|
{% if cookiecutter.use_mailhog == 'y' -%}
|
||||||
- mailhog
|
- mailhog
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
env_file:
|
||||||
|
- ./.envs/.local/.celery
|
||||||
ports: []
|
ports: []
|
||||||
command: /start-celerybeat.sh
|
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 = [
|
PRODUCTION_DOTENV_FILE_PATHS = [
|
||||||
os.path.join(PRODUCTION_DOTENVS_DIR_PATH, '.django'),
|
os.path.join(PRODUCTION_DOTENVS_DIR_PATH, '.django'),
|
||||||
os.path.join(PRODUCTION_DOTENVS_DIR_PATH, '.postgres'),
|
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'),
|
os.path.join(PRODUCTION_DOTENVS_DIR_PATH, '.caddy'),
|
||||||
]
|
]
|
||||||
DOTENV_FILE_PATH = os.path.join(ROOT_DIR_PATH, '.env')
|
DOTENV_FILE_PATH = os.path.join(ROOT_DIR_PATH, '.env')
|
||||||
|
|
|
@ -16,6 +16,9 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- ./.envs/.production/.django
|
- ./.envs/.production/.django
|
||||||
- ./.envs/.production/.postgres
|
- ./.envs/.production/.postgres
|
||||||
|
{%- if cookiecutter.use_celery == 'y' %}
|
||||||
|
- ./.envs/.production/.celery
|
||||||
|
{%- endif %}
|
||||||
command: /gunicorn.sh
|
command: /gunicorn.sh
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
|
@ -44,15 +47,15 @@ services:
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:3.0
|
image: redis:3.0
|
||||||
{% if cookiecutter.use_celery == 'y' %}
|
{%- if cookiecutter.use_celery == 'y' %}
|
||||||
|
|
||||||
celeryworker:
|
celeryworker:
|
||||||
<<: *django
|
<<: *django
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
- redis
|
- redis
|
||||||
env_file:
|
env_file:
|
||||||
- ./.envs/.production/.django
|
- ./.envs/.production/.celery
|
||||||
- ./.envs/.production/.postgres
|
|
||||||
command: /start-celeryworker.sh
|
command: /start-celeryworker.sh
|
||||||
|
|
||||||
celerybeat:
|
celerybeat:
|
||||||
|
@ -61,7 +64,7 @@ services:
|
||||||
- postgres
|
- postgres
|
||||||
- redis
|
- redis
|
||||||
env_file:
|
env_file:
|
||||||
- ./.envs/.production/.django
|
- ./.envs/.production/.celery
|
||||||
- ./.envs/.production/.postgres
|
|
||||||
command: /start-celerybeat.sh
|
command: /start-celerybeat.sh
|
||||||
{% endif %}
|
|
||||||
|
{%- endif %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user