From ce916f12e19f452eb342f227bf7c820a2ba25d21 Mon Sep 17 00:00:00 2001 From: Bernd Meyer Date: Fri, 3 Oct 2014 07:08:38 -0700 Subject: [PATCH 1/4] Added pytz to requirements/base.txt Added the latest version of pytz (2014.7) to requirements/base.txt to avoid errors with DateTime fields. --- {{cookiecutter.repo_name}}/requirements/base.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/{{cookiecutter.repo_name}}/requirements/base.txt b/{{cookiecutter.repo_name}}/requirements/base.txt index 8e579eea..74abc00a 100644 --- a/{{cookiecutter.repo_name}}/requirements/base.txt +++ b/{{cookiecutter.repo_name}}/requirements/base.txt @@ -32,5 +32,7 @@ django-autoslug==1.7.2 # Useful things django-avatar==2.0 +# Time zones support +pytz==2014.7 # Your custom requirements go here From 07435921a6e56362f010673b150dd097c48559f3 Mon Sep 17 00:00:00 2001 From: Bernd Meyer Date: Fri, 3 Oct 2014 08:04:09 -0700 Subject: [PATCH 2/4] Added database credentials and security check for db password. Added database credentials (user name: 'django', password: 'blank') and security check for db password. The security check will raise an error if the database password is 'blank' in production. --- .../{{cookiecutter.repo_name}}/config/__init__.py | 13 +++++++++++++ .../{{cookiecutter.repo_name}}/config/common.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/__init__.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/__init__.py index feb8c8e1..2fa0127a 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/__init__.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/__init__.py @@ -1,5 +1,18 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import +import os +from django.conf import settings +from django.core.checks import register, Error from .local import Local # noqa from .production import Production # noqa + + +@register(settings) +def dj_database_url_check(app_configs=None, **kwargs): + errors = [] + password = settings.DATABASES['default'].get('PASSWORD') + config = os.environ['DJANGO_CONFIGURATION'].lower() + if password == 'blank' and config == 'production': + errors.append(Error('Change the database password for production.')) + return errors diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/common.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/common.py index caa4d199..46c3e2a8 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/common.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/common.py @@ -112,7 +112,7 @@ class Common(Configuration): # DATABASE CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases - DATABASES = values.DatabaseURLValue('postgres://localhost/{{cookiecutter.repo_name}}') + DATABASES = values.DatabaseURLValue('postgres://localhost/django:blank{{cookiecutter.repo_name}}') # END DATABASE CONFIGURATION # CACHING From 63f64b648b2557fe1df7276a22a0e40960bf3960 Mon Sep 17 00:00:00 2001 From: Bernd Meyer Date: Fri, 3 Oct 2014 08:08:28 -0700 Subject: [PATCH 3/4] Fixed missing @ before db name. --- .../{{cookiecutter.repo_name}}/config/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/common.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/common.py index 46c3e2a8..f11e14fc 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/common.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/common.py @@ -112,7 +112,7 @@ class Common(Configuration): # DATABASE CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases - DATABASES = values.DatabaseURLValue('postgres://localhost/django:blank{{cookiecutter.repo_name}}') + DATABASES = values.DatabaseURLValue('postgres://localhost/django:blank@{{cookiecutter.repo_name}}') # END DATABASE CONFIGURATION # CACHING From 3900088772228c682133bf51523593fd895d355a Mon Sep 17 00:00:00 2001 From: Bernd Meyer Date: Fri, 3 Oct 2014 12:12:59 -0700 Subject: [PATCH 4/4] Added the latest version of pytz (2014.7) to requirements/base.txt to avoid errors with DateTime fields. --- .../{{cookiecutter.repo_name}}/config/__init__.py | 12 ------------ .../{{cookiecutter.repo_name}}/config/common.py | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/__init__.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/__init__.py index 2fa0127a..1dd14ecc 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/__init__.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/__init__.py @@ -1,18 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import -import os -from django.conf import settings -from django.core.checks import register, Error from .local import Local # noqa from .production import Production # noqa - -@register(settings) -def dj_database_url_check(app_configs=None, **kwargs): - errors = [] - password = settings.DATABASES['default'].get('PASSWORD') - config = os.environ['DJANGO_CONFIGURATION'].lower() - if password == 'blank' and config == 'production': - errors.append(Error('Change the database password for production.')) - return errors diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/common.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/common.py index f11e14fc..caa4d199 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/common.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/common.py @@ -112,7 +112,7 @@ class Common(Configuration): # DATABASE CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases - DATABASES = values.DatabaseURLValue('postgres://localhost/django:blank@{{cookiecutter.repo_name}}') + DATABASES = values.DatabaseURLValue('postgres://localhost/{{cookiecutter.repo_name}}') # END DATABASE CONFIGURATION # CACHING