Merge branch 'master' into master

This commit is contained in:
Daniel Roy Greenfeld 2017-02-13 10:50:52 -08:00 committed by GitHub
commit 15a8e875b5
18 changed files with 96 additions and 76 deletions

View File

@ -107,6 +107,7 @@ Listed in alphabetical order.
Lyla Fischer Lyla Fischer
Martin Blech Martin Blech
Mathijs Hoogland `@MathijsHoogland`_ Mathijs Hoogland `@MathijsHoogland`_
Matt Braymer-Hayes `@mattayes`_ @mattayes
Matt Linares Matt Linares
Matt Menzenski `@menzenski`_ Matt Menzenski `@menzenski`_
Matt Warren `@mfwarren`_ Matt Warren `@mfwarren`_
@ -124,9 +125,10 @@ Listed in alphabetical order.
Roman Osipenko `@romanosipenko`_ Roman Osipenko `@romanosipenko`_
Russell Davies Russell Davies
Sam Collins `@MightySCollins`_ Sam Collins `@MightySCollins`_
stepmr `@stepmr`_ Shupeyko Nikita `@webyneter`_
Sławek Ehlert `@slafs`_ Sławek Ehlert `@slafs`_
Srinivas Nyayapati `@shireenrao`_ Srinivas Nyayapati `@shireenrao`_
stepmr `@stepmr`_
Steve Steiner `@ssteinerX`_ Steve Steiner `@ssteinerX`_
Sule Marshall `@suledev`_ Sule Marshall `@suledev`_
Taylor Baldwin Taylor Baldwin
@ -193,6 +195,7 @@ Listed in alphabetical order.
.. _@knitatoms: https://github.com/knitatoms .. _@knitatoms: https://github.com/knitatoms
.. _@krzysztofzuraw: https://github.com/krzysztofzuraw .. _@krzysztofzuraw: https://github.com/krzysztofzuraw
.. _@MathijsHoogland: https://github.com/MathijsHoogland .. _@MathijsHoogland: https://github.com/MathijsHoogland
.. _@mattayes: https://github.com/mattayes
.. _@menzenski: https://github.com/menzenski .. _@menzenski: https://github.com/menzenski
.. _@mfwarren: https://github.com/mfwarren .. _@mfwarren: https://github.com/mfwarren
.. _@mimischi: https://github.com/mimischi .. _@mimischi: https://github.com/mimischi
@ -206,6 +209,7 @@ Listed in alphabetical order.
.. _@rm--: https://github.com/rm-- .. _@rm--: https://github.com/rm--
.. _@romanosipenko: https://github.com/romanosipenko .. _@romanosipenko: https://github.com/romanosipenko
.. _@shireenrao: https://github.com/shireenrao .. _@shireenrao: https://github.com/shireenrao
.. _@webyneter: https://github.com/webyneter
.. _@show0k: https://github.com/show0k .. _@show0k: https://github.com/show0k
.. _@shultz: https://github.com/shultz .. _@shultz: https://github.com/shultz
.. _@siauPatrick: https://github.com/siauPatrick .. _@siauPatrick: https://github.com/siauPatrick

View File

@ -15,7 +15,7 @@
"use_pycharm": "n", "use_pycharm": "n",
"windows": "n", "windows": "n",
"use_python3": "y", "use_python3": "y",
"use_docker": "y", "use_docker": "n",
"use_heroku": "n", "use_heroku": "n",
"use_elasticbeanstalk_experimental": "n", "use_elasticbeanstalk_experimental": "n",
"use_compressor": "n", "use_compressor": "n",

View File

@ -3,7 +3,7 @@ Deployment on Heroku
.. index:: Heroku .. index:: Heroku
You can either push the 'deploy' button in your generated README.rst or run these commands to deploy the project to Heroku: Run these commands to deploy the project to Heroku:
.. code-block:: bash .. code-block:: bash

View File

@ -47,7 +47,7 @@ Generate a secret key for yourself, eg like this:
.. code-block:: bash .. code-block:: bash
python -c 'import random; print("".join(random.SystemRandom().choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for _ in range(50)))' python -c 'import random;import string; print("".join(random.SystemRandom().choice(string.digits + string.ascii_letters + string.punctuation) for _ in range(50)))'
Make a note of it, since we'll need it here in the console and later on in the web app config tab. Make a note of it, since we'll need it here in the console and later on in the web app config tab.
@ -179,5 +179,3 @@ For subsequent deployments, the procedure is much simpler. In a Bash console:
And then go to the Web tab and hit **Reload** And then go to the Web tab and hit **Reload**
**TIP:** *if you're really keen, you can set up git-push based deployments: https://blog.pythonanywhere.com/87/* **TIP:** *if you're really keen, you can set up git-push based deployments: https://blog.pythonanywhere.com/87/*

View File

@ -155,7 +155,7 @@ If you have errors, you can always check your stack with `docker-compose`. Switc
Supervisor Example Supervisor Example
------------------- -------------------
Once you are ready with your initial setup, you wan't to make sure that your application is run by a process manager to Once you are ready with your initial setup, you want to make sure that your application is run by a process manager to
survive reboots and auto restarts in case of an error. You can use the process manager you are most familiar with. All survive reboots and auto restarts in case of an error. You can use the process manager you are most familiar with. All
it needs to do is to run `docker-compose up` in your projects root directory. it needs to do is to run `docker-compose up` in your projects root directory.

View File

@ -3,7 +3,14 @@ Settings
This project relies extensively on environment settings which **will not work with Apache/mod_wsgi setups**. It has been deployed successfully with both Gunicorn/Nginx and even uWSGI/Nginx. This project relies extensively on environment settings which **will not work with Apache/mod_wsgi setups**. It has been deployed successfully with both Gunicorn/Nginx and even uWSGI/Nginx.
For configuration purposes, the following table maps environment variables to their Django setting: For configuration purposes, the following table maps environment variables to their Django setting and project settings:
======================================= =========================== ============================================== ======================================================================
Environment Variable Django Setting Development Default Production Default
======================================= =========================== ============================================== ======================================================================
DJANGO_READ_DOT_ENV_FILE READ_DOT_ENV_FILE False False
======================================= =========================== ============================================== ======================================================================
======================================= =========================== ============================================== ====================================================================== ======================================= =========================== ============================================== ======================================================================

View File

@ -4,7 +4,7 @@
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" /> <env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
</envs> </envs>
<option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" /> <option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />

View File

@ -4,7 +4,7 @@
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" /> <env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
</envs> </envs>
<option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" /> <option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />

View File

@ -4,7 +4,7 @@
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" /> <env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
</envs> </envs>
<option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" /> <option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />

View File

@ -4,7 +4,7 @@
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" /> <env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
</envs> </envs>
<option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" /> <option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />

View File

@ -4,7 +4,7 @@
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" /> <env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
</envs> </envs>
<option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" /> <option name="SDK_HOME" value="docker-compose://$PROJECT_DIR$/dev.yml:pycharm/python" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />

View File

@ -16,11 +16,25 @@ ROOT_DIR = environ.Path(__file__) - 3 # ({{ cookiecutter.project_slug }}/config
APPS_DIR = ROOT_DIR.path('{{ cookiecutter.project_slug }}') APPS_DIR = ROOT_DIR.path('{{ cookiecutter.project_slug }}')
env = environ.Env() env = environ.Env()
env.read_env()
# Load operating system environment variables and then prepare to use them
env = environ.Env()
# .env file, should load only in development environment
READ_DOT_ENV_FILE = env('DJANGO_READ_DOT_ENV_FILE', default=False)
if READ_DOT_ENV_FILE:
# Operating System Environment variables have precedence over variables defined in the .env file,
# that is to say variables from the .env files will only be used if not defined
# as environment variables.
env_file = str(ROOT_DIR.path('.env'))
print('Loading : {}'.format(env_file))
env.read_env(env_file)
print('The .env file has been loaded. See common.py for more information')
# APP CONFIGURATION # APP CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
DJANGO_APPS = ( DJANGO_APPS = [
# Default Django apps: # Default Django apps:
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
@ -34,27 +48,27 @@ DJANGO_APPS = (
# Admin # Admin
'django.contrib.admin', 'django.contrib.admin',
) ]
THIRD_PARTY_APPS = ( THIRD_PARTY_APPS = [
'crispy_forms', # Form layouts 'crispy_forms', # Form layouts
'allauth', # registration 'allauth', # registration
'allauth.account', # registration 'allauth.account', # registration
'allauth.socialaccount', # registration 'allauth.socialaccount', # registration
) ]
# Apps specific for this project go here. # Apps specific for this project go here.
LOCAL_APPS = ( LOCAL_APPS = [
# custom users app # custom users app
'{{ cookiecutter.project_slug }}.users.apps.UsersConfig', '{{ cookiecutter.project_slug }}.users.apps.UsersConfig',
# Your stuff: custom apps go here # Your stuff: custom apps go here
) ]
# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps # See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
# MIDDLEWARE CONFIGURATION # MIDDLEWARE CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
MIDDLEWARE = ( MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
@ -62,7 +76,7 @@ MIDDLEWARE = (
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
) ]
# MIGRATIONS CONFIGURATION # MIGRATIONS CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -89,9 +103,9 @@ EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.s
# MANAGER CONFIGURATION # MANAGER CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins # See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
ADMINS = ( ADMINS = [
("""{{cookiecutter.author_name}}""", '{{cookiecutter.email}}'), ("""{{cookiecutter.author_name}}""", '{{cookiecutter.email}}'),
) ]
# See: https://docs.djangoproject.com/en/dev/ref/settings/#managers # See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
MANAGERS = ADMINS MANAGERS = ADMINS
@ -176,15 +190,15 @@ STATIC_ROOT = str(ROOT_DIR('staticfiles'))
STATIC_URL = '/static/' STATIC_URL = '/static/'
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS # See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
STATICFILES_DIRS = ( STATICFILES_DIRS = [
str(APPS_DIR.path('static')), str(APPS_DIR.path('static')),
) ]
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders # See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
STATICFILES_FINDERS = ( STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
) ]
# MEDIA CONFIGURATION # MEDIA CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -223,10 +237,10 @@ AUTH_PASSWORD_VALIDATORS = [
# AUTHENTICATION CONFIGURATION # AUTHENTICATION CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
AUTHENTICATION_BACKENDS = ( AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend', 'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend', 'allauth.account.auth_backends.AuthenticationBackend',
) ]
# Some really nice defaults # Some really nice defaults
ACCOUNT_AUTHENTICATION_METHOD = 'username' ACCOUNT_AUTHENTICATION_METHOD = 'username'
@ -247,9 +261,9 @@ LOGIN_URL = 'account_login'
AUTOSLUG_SLUGIFY_FUNCTION = 'slugify.slugify' AUTOSLUG_SLUGIFY_FUNCTION = 'slugify.slugify'
{% if cookiecutter.use_celery == 'y' %} {% if cookiecutter.use_celery == 'y' %}
########## CELERY ########## CELERY
INSTALLED_APPS += ('{{cookiecutter.project_slug}}.taskapp.celery.CeleryConfig',) INSTALLED_APPS += ['{{cookiecutter.project_slug}}.taskapp.celery.CeleryConfig']
# if you are not using the django database broker (e.g. rabbitmq, redis, memcached), you can remove the next line. # if you are not using the django database broker (e.g. rabbitmq, redis, memcached), you can remove the next line.
INSTALLED_APPS += ('kombu.transport.django',) INSTALLED_APPS += ['kombu.transport.django']
BROKER_URL = env('CELERY_BROKER_URL', default='django://') BROKER_URL = env('CELERY_BROKER_URL', default='django://')
if BROKER_URL == 'django://': if BROKER_URL == 'django://':
CELERY_RESULT_BACKEND = 'redis://' CELERY_RESULT_BACKEND = 'redis://'
@ -261,8 +275,8 @@ else:
{%- if cookiecutter.use_compressor == 'y'-%} {%- if cookiecutter.use_compressor == 'y'-%}
# django-compressor # django-compressor
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
INSTALLED_APPS += ("compressor", ) INSTALLED_APPS += ['compressor']
STATICFILES_FINDERS += ("compressor.finders.CompressorFinder", ) STATICFILES_FINDERS += ['compressor.finders.CompressorFinder']
{%- endif %} {%- endif %}
# Location of root django.contrib.admin URL, use {% raw %}{% url 'admin:index' %}{% endraw %} # Location of root django.contrib.admin URL, use {% raw %}{% url 'admin:index' %}{% endraw %}

View File

@ -14,7 +14,7 @@ Local settings
import socket import socket
import os import os
from .common import * # noqa from .base import * # noqa
# DEBUG # DEBUG
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -32,7 +32,7 @@ SECRET_KEY = env('DJANGO_SECRET_KEY', default='CHANGEME!!!')
EMAIL_PORT = 1025 EMAIL_PORT = 1025
{% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %} {% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %}
EMAIL_HOST = env("EMAIL_HOST", default='mailhog') EMAIL_HOST = env('EMAIL_HOST', default='mailhog')
{% else %} {% else %}
EMAIL_HOST = 'localhost' EMAIL_HOST = 'localhost'
EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND',
@ -50,14 +50,14 @@ CACHES = {
# django-debug-toolbar # django-debug-toolbar
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',) MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ]
INSTALLED_APPS += ('debug_toolbar', ) INSTALLED_APPS += ['debug_toolbar', ]
INTERNAL_IPS = ['127.0.0.1', '10.0.2.2', ] INTERNAL_IPS = ['127.0.0.1', '10.0.2.2', ]
# tricks to have debug toolbar when developing with docker # tricks to have debug toolbar when developing with docker
if os.environ.get('USE_DOCKER') == 'yes': if os.environ.get('USE_DOCKER') == 'yes':
ip = socket.gethostbyname(socket.gethostname()) ip = socket.gethostbyname(socket.gethostname())
INTERNAL_IPS += [ip[:-1] + "1"] INTERNAL_IPS += [ip[:-1] + '1']
DEBUG_TOOLBAR_CONFIG = { DEBUG_TOOLBAR_CONFIG = {
'DISABLE_PANELS': [ 'DISABLE_PANELS': [
@ -68,7 +68,7 @@ DEBUG_TOOLBAR_CONFIG = {
# django-extensions # django-extensions
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
INSTALLED_APPS += ('django_extensions', ) INSTALLED_APPS += ['django_extensions', ]
# TESTING # TESTING
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@ -20,7 +20,7 @@ from django.utils import six
import logging import logging
{% endif %} {% endif %}
from .common import * # noqa from .base import * # noqa
# SECRET CONFIGURATION # SECRET CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -36,30 +36,28 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
{%- if cookiecutter.use_sentry_for_error_reporting == 'y' %} {%- if cookiecutter.use_sentry_for_error_reporting == 'y' %}
# raven sentry client # raven sentry client
# See https://docs.sentry.io/clients/python/integrations/django/ # See https://docs.sentry.io/clients/python/integrations/django/
INSTALLED_APPS += ('raven.contrib.django.raven_compat', ) INSTALLED_APPS += ['raven.contrib.django.raven_compat', ]
{% endif %} {% endif %}
{%- if cookiecutter.use_whitenoise == 'y' %} {%- if cookiecutter.use_whitenoise == 'y' %}
# Use Whitenoise to serve static files # Use Whitenoise to serve static files
# See: https://whitenoise.readthedocs.io/ # See: https://whitenoise.readthedocs.io/
WHITENOISE_MIDDLEWARE = ('whitenoise.middleware.WhiteNoiseMiddleware', ) WHITENOISE_MIDDLEWARE = ['whitenoise.middleware.WhiteNoiseMiddleware', ]
MIDDLEWARE = WHITENOISE_MIDDLEWARE + MIDDLEWARE MIDDLEWARE = WHITENOISE_MIDDLEWARE + MIDDLEWARE
{% endif %} {% endif %}
{%- if cookiecutter.use_sentry_for_error_reporting == 'y' -%} {%- if cookiecutter.use_sentry_for_error_reporting == 'y' -%}
RAVEN_MIDDLEWARE = ('raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware', ) RAVEN_MIDDLEWARE = ['raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware']
MIDDLEWARE = RAVEN_MIDDLEWARE + MIDDLEWARE MIDDLEWARE = RAVEN_MIDDLEWARE + MIDDLEWARE
{% endif %} {% endif %}
{%- if cookiecutter.use_opbeat == 'y' -%} {%- if cookiecutter.use_opbeat == 'y' -%}
# opbeat integration # opbeat integration
# See https://opbeat.com/languages/django/ # See https://opbeat.com/languages/django/
INSTALLED_APPS += ('opbeat.contrib.django',) INSTALLED_APPS += ['opbeat.contrib.django', ]
OPBEAT = { OPBEAT = {
'ORGANIZATION_ID': env('DJANGO_OPBEAT_ORGANIZATION_ID'), 'ORGANIZATION_ID': env('DJANGO_OPBEAT_ORGANIZATION_ID'),
'APP_ID': env('DJANGO_OPBEAT_APP_ID'), 'APP_ID': env('DJANGO_OPBEAT_APP_ID'),
'SECRET_TOKEN': env('DJANGO_OPBEAT_SECRET_TOKEN') 'SECRET_TOKEN': env('DJANGO_OPBEAT_SECRET_TOKEN')
} }
MIDDLEWARE = ( MIDDLEWARE = ['opbeat.contrib.django.middleware.OpbeatAPMMiddleware', ] + MIDDLEWARE
'opbeat.contrib.django.middleware.OpbeatAPMMiddleware',
) + MIDDLEWARE
{% endif %} {% endif %}
# SECURITY CONFIGURATION # SECURITY CONFIGURATION
@ -85,10 +83,10 @@ X_FRAME_OPTIONS = 'DENY'
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Hosts/domain names that are valid for this site # Hosts/domain names that are valid for this site
# See https://docs.djangoproject.com/en/1.10/ref/settings/#allowed-hosts # See https://docs.djangoproject.com/en/1.10/ref/settings/#allowed-hosts
ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['{{cookiecutter.domain_name}}']) ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=['{{cookiecutter.domain_name}}', ])
# END SITE CONFIGURATION # END SITE CONFIGURATION
INSTALLED_APPS += ('gunicorn', ) INSTALLED_APPS += ['gunicorn', ]
# STORAGE CONFIGURATION # STORAGE CONFIGURATION
@ -96,9 +94,7 @@ INSTALLED_APPS += ('gunicorn', )
# Uploaded Media Files # Uploaded Media Files
# ------------------------ # ------------------------
# See: http://django-storages.readthedocs.io/en/latest/index.html # See: http://django-storages.readthedocs.io/en/latest/index.html
INSTALLED_APPS += ( INSTALLED_APPS += ['storages', ]
'storages',
)
AWS_ACCESS_KEY_ID = env('DJANGO_AWS_ACCESS_KEY_ID') AWS_ACCESS_KEY_ID = env('DJANGO_AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY') AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY')
@ -143,7 +139,7 @@ STATICFILES_STORAGE = 'config.settings.production.StaticRootS3BotoStorage'
# For Django 1.7+, 'collectfast' should come before # For Django 1.7+, 'collectfast' should come before
# 'django.contrib.staticfiles' # 'django.contrib.staticfiles'
AWS_PRELOAD_METADATA = True AWS_PRELOAD_METADATA = True
INSTALLED_APPS = ('collectfast', ) + INSTALLED_APPS INSTALLED_APPS = ['collectfast', ] + INSTALLED_APPS
{%- endif %} {%- endif %}
{% if cookiecutter.use_compressor == 'y'-%} {% if cookiecutter.use_compressor == 'y'-%}
# COMPRESSOR # COMPRESSOR
@ -160,12 +156,12 @@ EMAIL_SUBJECT_PREFIX = env('DJANGO_EMAIL_SUBJECT_PREFIX', default='[{{cookiecutt
SERVER_EMAIL = env('DJANGO_SERVER_EMAIL', default=DEFAULT_FROM_EMAIL) SERVER_EMAIL = env('DJANGO_SERVER_EMAIL', default=DEFAULT_FROM_EMAIL)
# Anymail with Mailgun # Anymail with Mailgun
INSTALLED_APPS += ("anymail", ) INSTALLED_APPS += ['anymail', ]
ANYMAIL = { ANYMAIL = {
"MAILGUN_API_KEY": env('DJANGO_MAILGUN_API_KEY'), 'MAILGUN_API_KEY': env('DJANGO_MAILGUN_API_KEY'),
"MAILGUN_SENDER_DOMAIN": env('MAILGUN_SENDER_DOMAIN') 'MAILGUN_SENDER_DOMAIN': env('MAILGUN_SENDER_DOMAIN')
} }
EMAIL_BACKEND = "anymail.backends.mailgun.MailgunBackend" EMAIL_BACKEND = 'anymail.backends.mailgun.MailgunBackend'
# TEMPLATE CONFIGURATION # TEMPLATE CONFIGURATION
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -199,7 +195,7 @@ DATABASES['default'] = env.db('DATABASE_URL')
# CACHING # CACHING
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
{% if cookiecutter.use_elasticbeanstalk_experimental.lower() == 'y' -%} {% if cookiecutter.use_elasticbeanstalk_experimental.lower() == 'y' -%}
REDIS_LOCATION = "redis://{}:{}/0".format( REDIS_LOCATION = 'redis://{}:{}/0'.format(
env('REDIS_ENDPOINT_ADDRESS'), env('REDIS_ENDPOINT_ADDRESS'),
env('REDIS_PORT') env('REDIS_PORT')
) )
@ -228,7 +224,7 @@ LOGGING = {
'disable_existing_loggers': True, 'disable_existing_loggers': True,
'root': { 'root': {
'level': 'WARNING', 'level': 'WARNING',
'handlers': ['sentry'], 'handlers': ['sentry', ],
}, },
'formatters': { 'formatters': {
'verbose': { 'verbose': {
@ -250,22 +246,22 @@ LOGGING = {
'loggers': { 'loggers': {
'django.db.backends': { 'django.db.backends': {
'level': 'ERROR', 'level': 'ERROR',
'handlers': ['console'], 'handlers': ['console', ],
'propagate': False, 'propagate': False,
}, },
'raven': { 'raven': {
'level': 'DEBUG', 'level': 'DEBUG',
'handlers': ['console'], 'handlers': ['console', ],
'propagate': False, 'propagate': False,
}, },
'sentry.errors': { 'sentry.errors': {
'level': 'DEBUG', 'level': 'DEBUG',
'handlers': ['console'], 'handlers': ['console', ],
'propagate': False, 'propagate': False,
}, },
'django.security.DisallowedHost': { 'django.security.DisallowedHost': {
'level': 'ERROR', 'level': 'ERROR',
'handlers': ['console', 'sentry'], 'handlers': ['console', 'sentry', ],
'propagate': False, 'propagate': False,
}, },
}, },
@ -301,7 +297,7 @@ LOGGING = {
'handlers': { 'handlers': {
'mail_admins': { 'mail_admins': {
'level': 'ERROR', 'level': 'ERROR',
'filters': ['require_debug_false'], 'filters': ['require_debug_false', ],
'class': 'django.utils.log.AdminEmailHandler' 'class': 'django.utils.log.AdminEmailHandler'
}, },
'console': { 'console': {
@ -312,13 +308,13 @@ LOGGING = {
}, },
'loggers': { 'loggers': {
'django.request': { 'django.request': {
'handlers': ['mail_admins'], 'handlers': ['mail_admins', ],
'level': 'ERROR', 'level': 'ERROR',
'propagate': True 'propagate': True
}, },
'django.security.DisallowedHost': { 'django.security.DisallowedHost': {
'level': 'ERROR', 'level': 'ERROR',
'handlers': ['console', 'mail_admins'], 'handlers': ['console', 'mail_admins', ],
'propagate': True 'propagate': True
} }
} }

View File

@ -5,7 +5,7 @@ Test settings
- Used to run tests fast on the continuous integration server and locally - Used to run tests fast on the continuous integration server and locally
''' '''
from .common import * # noqa from .base import * # noqa
# DEBUG # DEBUG
@ -47,16 +47,16 @@ TEST_RUNNER = 'django.test.runner.DiscoverRunner'
# PASSWORD HASHING # PASSWORD HASHING
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Use fast password hasher so tests run faster # Use fast password hasher so tests run faster
PASSWORD_HASHERS = ( PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher', 'django.contrib.auth.hashers.MD5PasswordHasher',
) ]
# TEMPLATE LOADERS # TEMPLATE LOADERS
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Keep templates in memory so tests run faster # Keep templates in memory so tests run faster
TEMPLATES[0]['OPTIONS']['loaders'] = [ TEMPLATES[0]['OPTIONS']['loaders'] = [
('django.template.loaders.cached.Loader', [ ['django.template.loaders.cached.Loader', [
'django.template.loaders.filesystem.Loader', 'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader', 'django.template.loaders.app_directories.Loader',
]), ], ],
] ]

View File

@ -4,6 +4,7 @@ POSTGRES_PASSWORD=mysecretpass
POSTGRES_USER=postgresuser POSTGRES_USER=postgresuser
# General settings # General settings
# DJANGO_READ_DOT_ENV_FILE=True
DJANGO_ADMIN_URL= DJANGO_ADMIN_URL=
DJANGO_SETTINGS_MODULE=config.settings.production DJANGO_SETTINGS_MODULE=config.settings.production
DJANGO_SECRET_KEY=CHANGEME!!! DJANGO_SECRET_KEY=CHANGEME!!!

View File

@ -1,2 +1,2 @@
[pytest] [pytest]
DJANGO_SETTINGS_MODULE=config.settings.local DJANGO_SETTINGS_MODULE=config.settings.test

View File

@ -1,9 +1,9 @@
{% raw %}{% extends "base.html" %} {% raw %}{% extends "base.html" %}
{% block title %}Page Not found{% endblock %} {% block title %}Page not found{% endblock %}
{% block content %} {% block content %}
<h1>Page Not found</h1> <h1>Page not found</h1>
<p>This is not the page you were looking for.</p> <p>This is not the page you were looking for.</p>
{% endblock content %}{% endraw %} {% endblock content %}{% endraw %}