Skip to content
This repository was archived by the owner on Sep 23, 2022. It is now read-only.

Commit 559839a

Browse files
committed
Settings examples
1 parent 841c79a commit 559839a

File tree

11 files changed

+249
-0
lines changed

11 files changed

+249
-0
lines changed

settings.example/__init__.py

Whitespace-only changes.

settings.example/base.py

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
2+
from django.contrib.messages import constants as messages
3+
from path.base import STATIC_DIR, TEMPLATES_DIR
4+
from django.core.urlresolvers import reverse_lazy
5+
from datetime import timedelta
6+
7+
SECRET_KEY = '<secret_key>'
8+
9+
ADMINS = (<admins_tuple>)
10+
11+
INSTALLED_APPS = (
12+
'django.contrib.auth',
13+
'django.contrib.contenttypes',
14+
'django.contrib.sessions',
15+
'django.contrib.messages',
16+
'django.contrib.staticfiles',
17+
'django.contrib.admin',
18+
19+
'easy_thumbnails',
20+
'rest_framework',
21+
'rest_framework_extensions',
22+
'registration',
23+
'debug_toolbar',
24+
'crispy_forms',
25+
26+
'ygo_core',
27+
'ygo_variables',
28+
'ygo_cards',
29+
'ygo_api',
30+
'ygo_import'
31+
)
32+
33+
MIDDLEWARE_CLASSES = (
34+
'htmlmin.middleware.HtmlMinifyMiddleware',
35+
'htmlmin.middleware.MarkRequestMiddleware',
36+
'django.contrib.sessions.middleware.SessionMiddleware',
37+
'django.middleware.common.CommonMiddleware',
38+
'django.middleware.csrf.CsrfViewMiddleware',
39+
'django.contrib.auth.middleware.AuthenticationMiddleware',
40+
'django.contrib.messages.middleware.MessageMiddleware',
41+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
42+
'debug_toolbar.middleware.DebugToolbarMiddleware',
43+
)
44+
45+
ROOT_URLCONF = 'ygo_core.urls'
46+
47+
SESSION_ENGINE = 'django.contrib.sessions.backends.file'
48+
49+
LANGUAGE_CODE = 'en-us'
50+
51+
TIME_ZONE = 'UTC'
52+
53+
USE_I18N = False
54+
55+
USE_L10N = False
56+
57+
USE_TZ = False
58+
59+
WSGI_APPLICATION = 'settings.wsgi.application'
60+
61+
TEMPLATE_DIRS = (
62+
TEMPLATES_DIR,
63+
)
64+
65+
TEMPLATE_CONTEXT_PROCESSORS = (
66+
'django.core.context_processors.request',
67+
'django.contrib.auth.context_processors.auth',
68+
'django.contrib.messages.context_processors.messages',
69+
'django.core.context_processors.media',
70+
'ygo_core.context_processors.settings'
71+
)
72+
73+
MEDIA_URL = '/media/'
74+
75+
STATIC_URL = '/static/'
76+
77+
STATICFILES_FINDERS = (
78+
'django.contrib.staticfiles.finders.FileSystemFinder',
79+
'django.contrib.staticfiles.finders.AppDirectoriesFinder'
80+
)
81+
82+
STATICFILES_DIRS = (STATIC_DIR,)
83+
84+
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
85+
86+
MESSAGE_TAGS = {
87+
messages.ERROR: 'danger',
88+
messages.SUCCESS: 'info'
89+
}
90+
91+
LOGIN_URL = reverse_lazy('auth_login')
92+
LOGOUT_URL = reverse_lazy('auth_logout')
93+
LOGIN_REDIRECT_URL = reverse_lazy('collection')
94+
95+
REST_FRAMEWORK = {
96+
'DEFAULT_AUTHENTICATION_CLASSES': (
97+
'rest_framework.authentication.SessionAuthentication',
98+
),
99+
'DEFAULT_PERMISSION_CLASSES': (
100+
'rest_framework.permissions.IsAuthenticated',
101+
)
102+
}
103+
104+
ACCOUNT_ACTIVATION_DAYS = 30
105+
REGISTRATION_AUTO_LOGIN = True
106+
107+
EMAIL_HOST = '<email_host>'
108+
EMAIL_HOST_USER = '<email_user>'
109+
EMAIL_HOST_PASSWORD = '<email_password>'
110+
EMAIL_USE_SSL = True
111+
EMAIL_PORT = <email_ssl_port>
112+
DEFAULT_FROM_EMAIL = '<email_from>'
113+
SERVER_EMAIL = '<server_email>'
114+
115+
INTERNAL_IPS = ['<internal_ip>',]
116+
117+
CRISPY_TEMPLATE_PACK = 'bootstrap3'
118+
119+
HTML_MINIFY = True
120+
121+
CELERY_SEND_TASK_ERROR_EMAILS = True
122+
123+
CELERYBEAT_SCHEDULE = {
124+
'fetch-cards': {
125+
'task': 'ygo_cards.tasks.cards.fetch_cards',
126+
'schedule': timedelta(hours=4),
127+
},
128+
'fetch-sets': {
129+
'task': 'ygo_cards.tasks.sets.fetch_sets',
130+
'schedule': timedelta(hours=1),
131+
},
132+
}
133+
134+
CELERY_TIMEZONE = 'UTC'

settings.example/local.py

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
from settings.base import *
3+
from path.local import BASE_DIR
4+
from os.path import join
5+
6+
DEBUG = True
7+
8+
TEMPLATE_DEBUG = DEBUG
9+
10+
DATABASES = {
11+
'default': {
12+
'ENGINE': 'django.db.backends.mysql',
13+
'NAME': '<database_name>',
14+
'USER': '<database_user>',
15+
'PASSWORD': '<database_password>',
16+
'HOST': '<database_host>',
17+
'PORT': ''
18+
}
19+
}
20+
21+
ALLOWED_HOSTS = ['<local_hostname>']
22+
23+
MEDIA_ROOT = join(BASE_DIR, '<name_of_media_directory>')
24+
25+
STATIC_ROOT = join(BASE_DIR, '<name_of_static_directory>')
26+
27+
CACHES = {
28+
'default': {
29+
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
30+
'KEY_PREFIX': 'ygorganizer',
31+
}
32+
}
33+
34+
# CACHES = {
35+
# 'default': {
36+
# 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
37+
# 'LOCATION': 'unix:<path/to/memcached/socket>',
38+
# 'KEY_PREFIX': 'ygorganizer',
39+
# }
40+
# }
41+
42+
TEMPLATE_LOADERS = (
43+
'django.template.loaders.filesystem.Loader',
44+
'django.template.loaders.app_directories.Loader',
45+
)
46+
47+
GA_ID = '<google_analytics_id>'

settings.example/path/__init__.py

Whitespace-only changes.

settings.example/path/base.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
from os.path import dirname, abspath, join
3+
4+
SOURCE_DIR = dirname(dirname(dirname(abspath(__file__))))
5+
STATIC_DIR = join(SOURCE_DIR, 'static')
6+
SETTINGS_DIR = join(SOURCE_DIR, 'settings')
7+
TEMPLATES_DIR = join(SOURCE_DIR, 'templates')

settings.example/path/local.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
from base import *
3+
from os.path import dirname
4+
5+
# Change this to the parent directory of the media and static folders.
6+
BASE_DIR = dirname(SOURCE_DIR)

settings.example/path/prod.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
from base import *
3+
from os.path import dirname
4+
5+
# Change this to the parent directory of the media and static folders.
6+
BASE_DIR = dirname(SOURCE_DIR)

settings.example/prod.py

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
from settings.base import *
3+
from path.prod import BASE_DIR
4+
from os.path import join
5+
6+
DEBUG = False
7+
8+
TEMPLATE_DEBUG = DEBUG
9+
10+
DATABASES = {
11+
'default': {
12+
'ENGINE': 'django.db.backends.mysql',
13+
'NAME': '<database_name>',
14+
'USER': '<database_user>',
15+
'PASSWORD': '<database_password>',
16+
'HOST': '<database_host>',
17+
'PORT': ''
18+
}
19+
}
20+
21+
ALLOWED_HOSTS = ['<production_domain>']
22+
23+
MEDIA_ROOT = join(BASE_DIR, '<name_of_media_directory>')
24+
25+
STATIC_ROOT = join(BASE_DIR, '<name_of_static_directory>')
26+
27+
CACHES = {
28+
'default': {
29+
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
30+
'LOCATION': 'unix:<path/to/memcached/socket>',
31+
'KEY_PREFIX': 'ygorganizer',
32+
}
33+
}
34+
35+
TEMPLATE_LOADERS = (
36+
('django.template.loaders.cached.Loader', (
37+
'django.template.loaders.filesystem.Loader',
38+
'django.template.loaders.app_directories.Loader',
39+
)),
40+
)
41+
42+
GA_ID = '<google_analytics_id>'

settings.example/wsgi.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import os
2+
3+
from django.core.wsgi import get_wsgi_application
4+
5+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings.prod')
6+
7+
application = get_wsgi_application()

ygo_import/migrations/0002_auto_20150605_1933.py

100755100644
File mode changed.

ygo_import/migrations/__init__.py

100755100644
File mode changed.

0 commit comments

Comments
 (0)