Celery code blocks are still generated even though Celery is not opted out for (#1587)

* Celery jinja condition in .gitignore

* Celery jinja conditions in Django Dockerfiles

* Re-phrase Django Dockerfile requirements comments

* Remove celery compose dirs through post_gen_project.py
This commit is contained in:
Nikita Shupeyko 2018-03-27 18:40:44 +03:00 committed by GitHub
parent 80ae32259c
commit 59cd5b4849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 6 deletions

View File

@ -254,6 +254,11 @@ def remove_celery_envs():
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'))
def main():
postgres_user = generate_postgres_user()
set_flags_in_envs(postgres_user)
@ -318,6 +323,7 @@ def main():
remove_celery_app()
if '{{ cookiecutter.use_docker }}'.lower() == 'y':
remove_celery_envs()
remove_celery_compose_dirs()
if '{{ cookiecutter.use_travisci }}'.lower() == 'n':
remove_dottravisyml_file()

View File

@ -62,8 +62,10 @@ target/
# pyenv
.python-version
{% if cookiecutter.use_celery == 'y' -%}
# celery beat schedule file
celerybeat-schedule
{%- endif %}
# Environments
.venv

View File

@ -15,7 +15,7 @@ RUN apk update \
# https://docs.djangoproject.com/en/2.0/ref/django-admin/#dbshell
&& apk add postgresql-client
# Requirements have to be pulled and installed here, otherwise caching won't work
# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN pip install -r /requirements/local.txt
@ -26,7 +26,7 @@ RUN chmod +x /entrypoint.sh
COPY ./compose/local/django/start.sh /start.sh
RUN sed -i 's/\r//' /start.sh
RUN chmod +x /start.sh
{% if cookiecutter.use_celery == "y" %}
COPY ./compose/local/django/celery/worker/start.sh /start-celeryworker.sh
RUN sed -i 's/\r//' /start-celeryworker.sh
RUN chmod +x /start-celeryworker.sh
@ -34,7 +34,7 @@ RUN chmod +x /start-celeryworker.sh
COPY ./compose/local/django/celery/beat/start.sh /start-celerybeat.sh
RUN sed -i 's/\r//' /start-celerybeat.sh
RUN chmod +x /start-celerybeat.sh
{% endif %}
WORKDIR /app
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -14,7 +14,7 @@ RUN apk update \
RUN addgroup -S django \
&& adduser -S -G django django
# Requirements have to be pulled and installed here, otherwise caching won't work
# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN pip install --no-cache-dir -r /requirements/production.txt \
&& rm -rf /requirements
@ -28,7 +28,7 @@ COPY ./compose/production/django/entrypoint.sh /entrypoint.sh
RUN sed -i 's/\r//' /entrypoint.sh
RUN chmod +x /entrypoint.sh
RUN chown django /entrypoint.sh
{% if cookiecutter.use_celery == "y" %}
COPY ./compose/production/django/celery/worker/start.sh /start-celeryworker.sh
RUN sed -i 's/\r//' /start-celeryworker.sh
RUN chmod +x /start-celeryworker.sh
@ -36,7 +36,7 @@ RUN chmod +x /start-celeryworker.sh
COPY ./compose/production/django/celery/beat/start.sh /start-celerybeat.sh
RUN sed -i 's/\r//' /start-celerybeat.sh
RUN chmod +x /start-celerybeat.sh
{% endif %}
COPY . /app
RUN chown -R django /app