From f45698af3e55245397405baedc4be646b3315859 Mon Sep 17 00:00:00 2001 From: Ger Schinkel Date: Thu, 7 May 2015 15:22:28 +0200 Subject: [PATCH 1/2] Update common.py postgres connection string By removing localhost we enable the default use of Unix sockets. --- {{cookiecutter.repo_name}}/config/settings/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.repo_name}}/config/settings/common.py b/{{cookiecutter.repo_name}}/config/settings/common.py index 6971dbd6..fe94c991 100644 --- a/{{cookiecutter.repo_name}}/config/settings/common.py +++ b/{{cookiecutter.repo_name}}/config/settings/common.py @@ -102,7 +102,7 @@ MANAGERS = ADMINS # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases DATABASES = { # Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ - 'default': env.db("DATABASE_URL", default="postgres://localhost/{{cookiecutter.repo_name}}"), + 'default': env.db("DATABASE_URL", default="postgres:///{{cookiecutter.repo_name}}"), } DATABASES['default']['ATOMIC_REQUESTS'] = True From 3696cea41f249ec7c0f2441d74d7a2d7d8fe522e Mon Sep 17 00:00:00 2001 From: Ger Schinkel Date: Thu, 7 May 2015 22:46:58 +0200 Subject: [PATCH 2/2] Added configuration option for Windows and if-statement for the postgres connection string. --- cookiecutter.json | 3 ++- {{cookiecutter.repo_name}}/config/settings/common.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index 7f9590dc..25233dbb 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -9,5 +9,6 @@ "timezone": "UTC", "now": "2015/01/13", "year": "{{ cookiecutter.now[:4] }}", - "use_whitenoise": "y" + "use_whitenoise": "y", + "windows": "n" } diff --git a/{{cookiecutter.repo_name}}/config/settings/common.py b/{{cookiecutter.repo_name}}/config/settings/common.py index fe94c991..97b25b06 100644 --- a/{{cookiecutter.repo_name}}/config/settings/common.py +++ b/{{cookiecutter.repo_name}}/config/settings/common.py @@ -102,7 +102,7 @@ MANAGERS = ADMINS # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases DATABASES = { # Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ - 'default': env.db("DATABASE_URL", default="postgres:///{{cookiecutter.repo_name}}"), + 'default': env.db("DATABASE_URL", default="postgres://{% if cookiecutter.windows == 'y' %}localhost{% endif %}/{{cookiecutter.repo_name}}"), } DATABASES['default']['ATOMIC_REQUESTS'] = True