2016-04-13 00:23:00 +03:00
|
|
|
"""
|
2017-10-12 20:36:44 +03:00
|
|
|
Local settings for {{cookiecutter.project_name}} project.
|
2014-05-25 18:50:13 +04:00
|
|
|
|
2015-04-26 08:08:23 +03:00
|
|
|
- Run in Debug mode
|
2016-08-31 18:48:25 +03:00
|
|
|
{% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %}
|
2017-10-12 20:36:44 +03:00
|
|
|
- Use mailhog for emails via Docker
|
2017-06-26 22:21:32 +03:00
|
|
|
{% elif cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'n' %}
|
|
|
|
- Use mailhog for emails
|
2016-08-31 18:48:25 +03:00
|
|
|
{% else %}
|
2015-04-26 08:08:23 +03:00
|
|
|
- Use console backend for emails
|
2016-08-31 18:48:25 +03:00
|
|
|
{% endif %}
|
2015-04-26 08:08:23 +03:00
|
|
|
- Add Django Debug Toolbar
|
|
|
|
- Add django-extensions as app
|
2016-04-13 00:23:00 +03:00
|
|
|
"""
|
2014-05-25 18:50:13 +04:00
|
|
|
|
2017-01-17 06:38:52 +03:00
|
|
|
from .base import * # noqa
|
2015-04-20 00:09:00 +03:00
|
|
|
|
2018-03-04 17:51:37 +03:00
|
|
|
# SITE CONFIGURATION
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
ALLOWED_HOSTS = [
|
|
|
|
"localhost",
|
|
|
|
"0.0.0.0",
|
|
|
|
]
|
|
|
|
|
2015-04-20 00:09:00 +03:00
|
|
|
# DEBUG
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
DEBUG = env.bool('DJANGO_DEBUG', default=True)
|
2015-05-08 05:13:49 +03:00
|
|
|
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
|
2015-04-20 00:09:00 +03:00
|
|
|
|
|
|
|
# SECRET CONFIGURATION
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
|
|
|
|
# Note: This key only used for development and testing.
|
2018-02-07 22:52:52 +03:00
|
|
|
SECRET_KEY = env('DJANGO_SECRET_KEY', default='!!!SET DJANGO_SECRET_KEY!!!')
|
2015-04-20 00:09:00 +03:00
|
|
|
|
|
|
|
# Mail settings
|
|
|
|
# ------------------------------------------------------------------------------
|
2016-04-11 00:18:38 +03:00
|
|
|
|
2015-04-20 00:09:00 +03:00
|
|
|
EMAIL_PORT = 1025
|
2016-04-11 00:18:38 +03:00
|
|
|
{% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %}
|
2017-02-13 21:33:52 +03:00
|
|
|
EMAIL_HOST = env('EMAIL_HOST', default='mailhog')
|
2017-06-26 22:21:32 +03:00
|
|
|
{% elif cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'n' %}
|
|
|
|
EMAIL_HOST = 'localhost'
|
2016-04-11 00:18:38 +03:00
|
|
|
{% else %}
|
|
|
|
EMAIL_HOST = 'localhost'
|
2015-07-16 07:21:06 +03:00
|
|
|
EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND',
|
|
|
|
default='django.core.mail.backends.console.EmailBackend')
|
2016-04-11 00:18:38 +03:00
|
|
|
{% endif %}
|
2015-04-20 00:09:00 +03:00
|
|
|
|
|
|
|
# CACHING
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
CACHES = {
|
|
|
|
'default': {
|
|
|
|
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
|
|
|
'LOCATION': ''
|
|
|
|
}
|
|
|
|
}
|
2014-05-25 18:50:13 +04:00
|
|
|
|
2015-04-20 00:09:00 +03:00
|
|
|
# django-debug-toolbar
|
|
|
|
# ------------------------------------------------------------------------------
|
2017-02-13 21:33:52 +03:00
|
|
|
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ]
|
|
|
|
INSTALLED_APPS += ['debug_toolbar', ]
|
2014-05-25 18:50:13 +04:00
|
|
|
|
2016-06-18 05:09:08 +03:00
|
|
|
INTERNAL_IPS = ['127.0.0.1', '10.0.2.2', ]
|
2017-04-17 20:54:01 +03:00
|
|
|
{% if cookiecutter.use_docker == 'y' %}
|
2017-04-21 18:52:53 +03:00
|
|
|
{# [cookiecutter-django] This is a workaround to flake8 "imported but unused" errors #}
|
|
|
|
import socket
|
|
|
|
import os
|
2016-06-18 05:09:08 +03:00
|
|
|
# tricks to have debug toolbar when developing with docker
|
|
|
|
if os.environ.get('USE_DOCKER') == 'yes':
|
|
|
|
ip = socket.gethostbyname(socket.gethostname())
|
2017-02-13 21:33:52 +03:00
|
|
|
INTERNAL_IPS += [ip[:-1] + '1']
|
2017-04-17 20:54:01 +03:00
|
|
|
{% endif %}
|
2015-04-20 00:09:00 +03:00
|
|
|
DEBUG_TOOLBAR_CONFIG = {
|
|
|
|
'DISABLE_PANELS': [
|
|
|
|
'debug_toolbar.panels.redirects.RedirectsPanel',
|
|
|
|
],
|
|
|
|
'SHOW_TEMPLATE_CONTEXT': True,
|
|
|
|
}
|
2014-05-25 18:50:13 +04:00
|
|
|
|
2015-04-26 08:08:23 +03:00
|
|
|
# django-extensions
|
|
|
|
# ------------------------------------------------------------------------------
|
2017-02-13 21:33:52 +03:00
|
|
|
INSTALLED_APPS += ['django_extensions', ]
|
2015-04-26 08:08:23 +03:00
|
|
|
|
2015-04-25 16:05:33 +03:00
|
|
|
# TESTING
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
2016-04-13 00:23:00 +03:00
|
|
|
{% if cookiecutter.use_celery == 'y' %}
|
2014-10-12 12:32:17 +04:00
|
|
|
########## CELERY
|
|
|
|
# In development, all tasks will be executed locally by blocking until the task returns
|
|
|
|
CELERY_ALWAYS_EAGER = True
|
|
|
|
########## END CELERY
|
|
|
|
{% endif %}
|
2015-04-20 00:09:00 +03:00
|
|
|
# Your local stuff: Below this line define 3rd party library settings
|
2016-08-31 18:56:25 +03:00
|
|
|
# ------------------------------------------------------------------------------
|