· 6 years ago · Aug 17, 2019, 12:32 PM
1import os
2import django_heroku
3
4SECRET_KEY = 'secret_key'
5
6# DEBUG = True
7DEBUG = False
8
9ALLOWED_HOSTS = ['kasir.herokuapp.com', '*']
10
11
12# Application definition
13
14INSTALLED_APPS = [
15 'home',
16 ....
17 ....
18]
19
20MIDDLEWARE = [
21 'django.middleware.security.SecurityMiddleware',
22 'django.contrib.sessions.middleware.SessionMiddleware',
23 'django.middleware.common.CommonMiddleware',
24 'django.middleware.csrf.CsrfViewMiddleware',
25 'django.contrib.auth.middleware.AuthenticationMiddleware',
26 'django.contrib.messages.middleware.MessageMiddleware',
27 'django.middleware.clickjacking.XFrameOptionsMiddleware',
28 # 'whitenoise.middleware.WhiteNoiseMiddleware',
29]
30
31ROOT_URLCONF = 'cashier.urls'
32
33TEMPLATES = [
34 {
35 'BACKEND': 'django.template.backends.django.DjangoTemplates',
36 'DIRS': [os.path.join(BASE_DIR, 'templates')],
37 'APP_DIRS': True,
38 'OPTIONS': {
39 'context_processors': [
40 'django.template.context_processors.debug',
41 'django.template.context_processors.request',
42 'django.contrib.auth.context_processors.auth',
43 'django.contrib.messages.context_processors.messages',
44 ],
45 },
46 },
47]
48
49WSGI_APPLICATION = 'cashier.wsgi.application'
50
51# Database
52# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
53
54# "Development"
55# DATABASES = {
56# 'default': {
57# 'ENGINE': 'django.db.backends.sqlite3',
58# 'NAME': 'sqlite3.db',
59# 'PASSWORD': '',
60# 'USER': '',
61# 'HOST': '',
62# 'PORT': '',
63# }
64# }
65
66"Production"
67# DATABASES = {
68# 'default': {
69# 'ENGINE' : 'django.db.backends.postgresql_psycopg2',
70# 'NAME': '',
71# 'USER': '',
72# 'PASSWORD': '',
73# 'HOST': '*',
74# 'PORT' : '5432'
75# }
76# }
77
78"Demo"
79DATABASES = {
80 'default': {
81 'ENGINE': 'django.db.backends.sqlite3',
82 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
83 }
84}
85
86
87
88# Password validation
89# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
90
91AUTH_PASSWORD_VALIDATORS = [
92 {
93 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
94 },
95 {
96 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
97 },
98 {
99 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
100 },
101 {
102 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
103 },
104]
105
106
107# Internationalization
108# https://docs.djangoproject.com/en/2.2/topics/i18n/
109
110LANGUAGE_CODE = 'en-us'
111
112TIME_ZONE = 'Asia/Bangkok'
113
114USE_I18N = True
115
116USE_L10N = True
117
118USE_TZ = True
119
120
121# Static files (CSS, JavaScript, Images)
122# https://docs.djangoproject.com/en/2.2/howto/static-files/
123
124# STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'static')
125# STATIC_URL = '/static/'
126#
127# STATICFILES_DIRS = (
128# os.path.join(BASE_DIR, 'static'),
129# )
130
131STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
132STATIC_URL = '/static/'
133
134STATICFILES_DIRS = (
135 os.path.join(BASE_DIR, 'static'),
136)
137# STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
138
139"Satic Files Handling"
140# STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
141
142MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
143MEDIA_URL = '/media/'
144
145LOGIN_REDIRECT_URL = '/'
146LOGOUT_REDIRECT_URL = 'Login'
147LOGIN_URL = 'Login'
148
149"Email Handling Form"
150EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
151
152"API"
153REST_FRAMEWORK = {
154 'DEFAULT_PERMISSION_CLASSES': [
155 'rest_framework.permissions.IsAdminUser',
156 ],
157 #JSON Templates Render
158 # 'DEFAULT_RENDERER_CLASSES': [
159 # 'rest_framework.renderers.JSONRenderer',
160 # ],
161 # 'DEFAULT_PARSER_CLASSES': [
162 # 'rest_framework.parsers.JSONParser',
163 # ]
164}
165
166
167"Menu Compact Changer" #Default = False
168JET_SIDE_MENU_COMPACT = True
169
170"Sibling Links" #Default False
171JET_CHANGE_FORM_SIBLING_LINKS = True
172"Admin Index"
173JET_INDEX_DASHBOARD = 'dashboard.DefaultIndexDashboard'
174JET_APP_INDEX_DASHBOARD = 'jet.dashboard.dashboard.DefaultAppIndexDashboard'
175
176"Analytics Setup"
177JET_MODULE_GOOGLE_ANALYTICS_CLIENT_SECRETS_FILE = os.path.join(BASE_DIR, 'client_secrets.json')
178
179
180"Redis & Celery Setup"
181BROKER_URL = 'redis://localhost:6379'
182CELERY_RESULT_BACKEND = 'redis://localhost:6379'
183CELERY_ACCEPT_CONTENT = ['application/json']
184CELERY_TASK_SERIALIZER = 'json'
185CELERY_RESULT_SERIALIZER = 'json'
186CELERY_TIMEZONE = 'Asia/Jakarta'
187
188
189django_heroku.settings(locals())