diff --git a/README.rst b/README.rst index 2c3160af3..5f118dd78 100644 --- a/README.rst +++ b/README.rst @@ -37,7 +37,7 @@ Features * Pre configured Celery_ (optional) * Integration with Maildump_ for local email testing (optional) * Integration with Sentry_ for error logging (optional) -* Docker support using docker-compose_ for dev and prod +* Docker support using docker-compose_ for dev (with debug) and prod .. _Hitch: https://github.com/hitchtest/hitchtest .. _Bootstrap: https://github.com/twbs/bootstrap diff --git a/cookiecutter.json b/cookiecutter.json index dd8d7b1dd..73f88a3e7 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -13,6 +13,6 @@ "use_celery": "n", "use_maildump": "n", "use_sentry": "n", - "docker": "y", + "use_docker": "n", "windows": "n" } diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py new file mode 100644 index 000000000..7b2f95e59 --- /dev/null +++ b/hooks/post_gen_project.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +import os +import shutil + +project_directory = os.path.realpath(os.path.curdir) + +docker = '{{cookiecutter.use_docker}}' == 'y' + +docker_files = [ + 'debug.yml', + 'dev.yml', + 'docker-compose.yml', + 'Dockerfile' +] + +docker_dirs = [ + 'compose/', +] + +if not docker: + for path in docker_files: + os.remove(os.path.join(project_directory, path)) + + for path in docker_dirs: + shutil.rmtree(os.path.join(project_directory, path)) diff --git a/{{cookiecutter.repo_name}}/config/settings/common.py b/{{cookiecutter.repo_name}}/config/settings/common.py index 136093658..08ff8085f 100644 --- a/{{cookiecutter.repo_name}}/config/settings/common.py +++ b/{{cookiecutter.repo_name}}/config/settings/common.py @@ -99,7 +99,7 @@ MANAGERS = ADMINS # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases DATABASES = { # Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ - {% if cookiecutter.docker == 'y' %} + {% if cookiecutter.use_docker == 'y' %} 'default': 'postgres://postgres@postgres/postgres'), {% else %} 'default': env.db("DATABASE_URL", default="postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.repo_name}}"),