mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-01-23 15:54:12 +03:00
Settings file for running tests faster
This commit is contained in:
parent
7bd3615f11
commit
958bdee3e5
|
@ -2,6 +2,10 @@
|
|||
All enhancements and patches to Cookiecutter Django will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
##[2016-06-24]
|
||||
## Added
|
||||
- Settings file for running tests faster (@audreyr)
|
||||
|
||||
##[2016-06-19]
|
||||
## Added
|
||||
- Webpack as an option (@goldhand)
|
||||
|
|
64
{{cookiecutter.project_slug}}/config/settings/test.py
Normal file
64
{{cookiecutter.project_slug}}/config/settings/test.py
Normal file
|
@ -0,0 +1,64 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Test settings
|
||||
|
||||
- Used to run tests fast on the continuous integration server and locally
|
||||
- Use console backend for emails
|
||||
- Add django-extensions as app
|
||||
'''
|
||||
|
||||
from .common import * # noqa
|
||||
|
||||
|
||||
# DEBUG
|
||||
# ------------------------------------------------------------------------------
|
||||
# Turn debug off so tests run faster
|
||||
DEBUG = False
|
||||
TEMPLATES[0]['OPTIONS']['debug'] = False
|
||||
|
||||
# SECRET CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
|
||||
# Note: This key only used for development and testing.
|
||||
SECRET_KEY = env('DJANGO_SECRET_KEY', default='CHANGEME!!!')
|
||||
|
||||
# Mail settings
|
||||
# ------------------------------------------------------------------------------
|
||||
EMAIL_HOST = 'localhost'
|
||||
EMAIL_PORT = 1025
|
||||
|
||||
# In-memory email backend stores messages in django.core.mail.outbox
|
||||
# for unit testing purposes
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
|
||||
|
||||
# CACHING
|
||||
# ------------------------------------------------------------------------------
|
||||
# Speed advantages of in-memory caching without having to run Memcached
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||
'LOCATION': ''
|
||||
}
|
||||
}
|
||||
|
||||
# TESTING
|
||||
# ------------------------------------------------------------------------------
|
||||
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
||||
|
||||
|
||||
# PASSWORD HASHING
|
||||
# ------------------------------------------------------------------------------
|
||||
# Use fast password hasher so tests run faster
|
||||
PASSWORD_HASHERS = (
|
||||
'django.contrib.auth.hashers.MD5PasswordHasher',
|
||||
)
|
||||
|
||||
# TEMPLATE LOADERS
|
||||
# ------------------------------------------------------------------------------
|
||||
# Keep templates in memory so tests run faster
|
||||
TEMPLATES[0]['OPTIONS']['loaders'] = [
|
||||
('django.template.loaders.cached.Loader', [
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
]),
|
||||
]
|
Loading…
Reference in New Issue
Block a user