mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-01-24 00:04:13 +03:00
* Set CONN_MAX_AGE to 60 seconds -- fixes #710 Setting the value in the production config. * Get CONN_MAX_AGE from the environment, default to 60 in .env * Add test for CONN_MAX_AGE setting * Remove duplication in default value & test cleanup * Remove test for CONN_MAX_AGE value in settings
This commit is contained in:
parent
b00b402774
commit
4f8cd89bb7
|
@ -169,7 +169,7 @@ TEMPLATES[0]['OPTIONS']['loaders'] = [
|
||||||
('django.template.loaders.cached.Loader', [
|
('django.template.loaders.cached.Loader', [
|
||||||
'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ]),
|
'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ]),
|
||||||
]
|
]
|
||||||
|
{% set _DEFAULT_CONN_MAX_AGE=60 %}
|
||||||
# DATABASE CONFIGURATION
|
# DATABASE CONFIGURATION
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
{% if cookiecutter.use_elasticbeanstalk_experimental.lower() == 'y' -%}
|
{% if cookiecutter.use_elasticbeanstalk_experimental.lower() == 'y' -%}
|
||||||
|
@ -182,12 +182,14 @@ DATABASES = {
|
||||||
'PASSWORD': env('RDS_PASSWORD'),
|
'PASSWORD': env('RDS_PASSWORD'),
|
||||||
'HOST': env('RDS_HOSTNAME'),
|
'HOST': env('RDS_HOSTNAME'),
|
||||||
'PORT': env('RDS_PORT'),
|
'PORT': env('RDS_PORT'),
|
||||||
|
'CONN_MAX_AGE': env.int('CONN_MAX_AGE', default={{ _DEFAULT_CONN_MAX_AGE }}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{% else %}
|
{% else %}
|
||||||
# Use the Heroku-style specification
|
# Use the Heroku-style specification
|
||||||
# Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ
|
# Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ
|
||||||
DATABASES['default'] = env.db('DATABASE_URL')
|
DATABASES['default'] = env.db('DATABASE_URL')
|
||||||
|
DATABASES['default']['CONN_MAX_AGE'] = env.int('CONN_MAX_AGE', default={{ _DEFAULT_CONN_MAX_AGE }})
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
# CACHING
|
# CACHING
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# PostgreSQL
|
# PostgreSQL
|
||||||
POSTGRES_PASSWORD=mysecretpass
|
POSTGRES_PASSWORD=mysecretpass
|
||||||
POSTGRES_USER=postgresuser
|
POSTGRES_USER=postgresuser
|
||||||
|
CONN_MAX_AGE=
|
||||||
|
|
||||||
# Domain name, used by caddy
|
# Domain name, used by caddy
|
||||||
DOMAIN_NAME={{ cookiecutter.domain_name }}
|
DOMAIN_NAME={{ cookiecutter.domain_name }}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user