mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-28 20:44:04 +03:00
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:
parent
80ae32259c
commit
59cd5b4849
|
@ -254,6 +254,11 @@ def remove_celery_envs():
|
||||||
os.remove(os.path.join('.envs', '.production', '.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'))
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
@ -318,6 +323,7 @@ def main():
|
||||||
remove_celery_app()
|
remove_celery_app()
|
||||||
if '{{ cookiecutter.use_docker }}'.lower() == 'y':
|
if '{{ cookiecutter.use_docker }}'.lower() == 'y':
|
||||||
remove_celery_envs()
|
remove_celery_envs()
|
||||||
|
remove_celery_compose_dirs()
|
||||||
|
|
||||||
if '{{ cookiecutter.use_travisci }}'.lower() == 'n':
|
if '{{ cookiecutter.use_travisci }}'.lower() == 'n':
|
||||||
remove_dottravisyml_file()
|
remove_dottravisyml_file()
|
||||||
|
|
2
{{cookiecutter.project_slug}}/.gitignore
vendored
2
{{cookiecutter.project_slug}}/.gitignore
vendored
|
@ -62,8 +62,10 @@ target/
|
||||||
# pyenv
|
# pyenv
|
||||||
.python-version
|
.python-version
|
||||||
|
|
||||||
|
{% if cookiecutter.use_celery == 'y' -%}
|
||||||
# celery beat schedule file
|
# celery beat schedule file
|
||||||
celerybeat-schedule
|
celerybeat-schedule
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
# Environments
|
# Environments
|
||||||
.venv
|
.venv
|
||||||
|
|
|
@ -15,7 +15,7 @@ RUN apk update \
|
||||||
# https://docs.djangoproject.com/en/2.0/ref/django-admin/#dbshell
|
# https://docs.djangoproject.com/en/2.0/ref/django-admin/#dbshell
|
||||||
&& apk add postgresql-client
|
&& 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
|
COPY ./requirements /requirements
|
||||||
RUN pip install -r /requirements/local.txt
|
RUN pip install -r /requirements/local.txt
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ RUN chmod +x /entrypoint.sh
|
||||||
COPY ./compose/local/django/start.sh /start.sh
|
COPY ./compose/local/django/start.sh /start.sh
|
||||||
RUN sed -i 's/\r//' /start.sh
|
RUN sed -i 's/\r//' /start.sh
|
||||||
RUN chmod +x /start.sh
|
RUN chmod +x /start.sh
|
||||||
|
{% if cookiecutter.use_celery == "y" %}
|
||||||
COPY ./compose/local/django/celery/worker/start.sh /start-celeryworker.sh
|
COPY ./compose/local/django/celery/worker/start.sh /start-celeryworker.sh
|
||||||
RUN sed -i 's/\r//' /start-celeryworker.sh
|
RUN sed -i 's/\r//' /start-celeryworker.sh
|
||||||
RUN chmod +x /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
|
COPY ./compose/local/django/celery/beat/start.sh /start-celerybeat.sh
|
||||||
RUN sed -i 's/\r//' /start-celerybeat.sh
|
RUN sed -i 's/\r//' /start-celerybeat.sh
|
||||||
RUN chmod +x /start-celerybeat.sh
|
RUN chmod +x /start-celerybeat.sh
|
||||||
|
{% endif %}
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
@ -14,7 +14,7 @@ RUN apk update \
|
||||||
RUN addgroup -S django \
|
RUN addgroup -S django \
|
||||||
&& adduser -S -G django 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
|
COPY ./requirements /requirements
|
||||||
RUN pip install --no-cache-dir -r /requirements/production.txt \
|
RUN pip install --no-cache-dir -r /requirements/production.txt \
|
||||||
&& rm -rf /requirements
|
&& rm -rf /requirements
|
||||||
|
@ -28,7 +28,7 @@ COPY ./compose/production/django/entrypoint.sh /entrypoint.sh
|
||||||
RUN sed -i 's/\r//' /entrypoint.sh
|
RUN sed -i 's/\r//' /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
RUN chown django /entrypoint.sh
|
RUN chown django /entrypoint.sh
|
||||||
|
{% if cookiecutter.use_celery == "y" %}
|
||||||
COPY ./compose/production/django/celery/worker/start.sh /start-celeryworker.sh
|
COPY ./compose/production/django/celery/worker/start.sh /start-celeryworker.sh
|
||||||
RUN sed -i 's/\r//' /start-celeryworker.sh
|
RUN sed -i 's/\r//' /start-celeryworker.sh
|
||||||
RUN chmod +x /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
|
COPY ./compose/production/django/celery/beat/start.sh /start-celerybeat.sh
|
||||||
RUN sed -i 's/\r//' /start-celerybeat.sh
|
RUN sed -i 's/\r//' /start-celerybeat.sh
|
||||||
RUN chmod +x /start-celerybeat.sh
|
RUN chmod +x /start-celerybeat.sh
|
||||||
|
{% endif %}
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
RUN chown -R django /app
|
RUN chown -R django /app
|
||||||
|
|
Loading…
Reference in New Issue
Block a user