· 6 years ago · Oct 15, 2019, 10:06 AM
1"""
2Django settings for core project.
3
4Generated by 'django-admin startproject' using Django 2.1.3.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/2.1/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/2.1/ref/settings/
11"""
12
13import os
14
15# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
18
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = 'nifp6up^^bh^7c_26a6cuy$0p&8$fadg+-)5&dv0k6e$gbp$hn'
24
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = True
27
28ALLOWED_HOSTS = ['*']
29
30CORS_ORIGIN_ALLOW_ALL = True
31
32
33# Application definition
34
35INSTALLED_APPS = [
36 'django.contrib.admin',
37 'django.contrib.auth',
38 'django.contrib.contenttypes',
39 'django.contrib.sessions',
40 'django.contrib.messages',
41 'django.contrib.staticfiles',
42
43 'rest_framework',
44 'corsheaders',
45 'v1',
46 'usb_api_caller_v2',
47]
48
49MIDDLEWARE = [
50 'corsheaders.middleware.CorsMiddleware',
51 'django.middleware.security.SecurityMiddleware',
52 'django.contrib.sessions.middleware.SessionMiddleware',
53 'django.middleware.common.CommonMiddleware',
54 'django.middleware.csrf.CsrfViewMiddleware',
55 'django.contrib.auth.middleware.AuthenticationMiddleware',
56 'django.contrib.messages.middleware.MessageMiddleware',
57 'django.middleware.clickjacking.XFrameOptionsMiddleware',
58]
59
60ROOT_URLCONF = 'core.urls'
61
62TEMPLATES = [
63 {
64 'BACKEND': 'django.template.backends.django.DjangoTemplates',
65 'DIRS': [],
66 'APP_DIRS': True,
67 'OPTIONS': {
68 'context_processors': [
69 'django.template.context_processors.debug',
70 'django.template.context_processors.request',
71 'django.contrib.auth.context_processors.auth',
72 'django.contrib.messages.context_processors.messages',
73 ],
74 },
75 },
76]
77
78WSGI_APPLICATION = 'core.wsgi.application'
79
80
81# Database
82# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
83
84DATABASES = {
85 'default': {
86 'ENGINE': 'django.db.backends.postgresql',
87 'NAME': 'usbapi',
88 'USER': 'postgres',
89 'PASSWORD': 'aapbd',
90 'HOST': '127.0.0.1',
91 'PORT': '5432',
92
93 # 'ENGINE': 'django.db.backends.sqlite3',
94 # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
95 }
96}
97
98
99# Password validation
100# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
101
102AUTH_PASSWORD_VALIDATORS = [
103 {
104 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
105 },
106 {
107 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
108 },
109 {
110 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
111 },
112 {
113 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
114 },
115]
116
117
118# Internationalization
119# https://docs.djangoproject.com/en/2.1/topics/i18n/
120
121LANGUAGE_CODE = 'en-us'
122
123TIME_ZONE = 'UTC'
124
125USE_I18N = True
126
127USE_L10N = True
128
129USE_TZ = True
130
131
132# Static files (CSS, JavaScript, Images)
133# https://docs.djangoproject.com/en/2.1/howto/static-files/
134
135STATIC_ROOT = os.path.join(BASE_DIR, "static")
136
137STATIC_URL = '/static/'
138
139
140REST_FRAMEWORK = {
141 # # Use Django's standard `django.contrib.auth` permissions,
142 # # or allow read-only access for unauthenticated users.
143 # 'DEFAULT_PERMISSION_CLASSES': [
144 # 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly',
145 # ],
146 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
147 'PAGE_SIZE': 10,
148}
149
150
151# api info for live production
152TTI_API_URL = 'http://wsapi-apac.ttinteractive.com/Zenith/TTI.PublicApi.Services/JsonSaleEngineService.svc/'
153TTI_API_ACCESS_CODE = '_JEAAAABWU_EYtV0PDQ5AefVBXqTISe7_EqErTgeZryEzUyElkoBqCSdJh8UQdKZLhbSW62OVwi7Ix58ZnGrS9CBDxSnz7g_U'
154
155
156#api info for preproduction
157#TTI_API_URL = 'http://tstws2.ttinteractive.com/Zenith/TTI.PublicApi.Services/JsonSaleEngineService.svc/'
158#TTI_API_ACCESS_CODE = '_JEAAAAL436mpPsYP3m2lwfwBiLPdzcUQEHyecX5mtHR1RMK0DTHTEiyA_EYVUazFkn3rIGIGu6wxA8qa1gYyfs1uOib4E_U'
159
160# TTI_API_URL = os.environ.get('TTI_API_URL', '')
161# TTI_API_ACCESS_CODE = os.environ.get('TTI_API_ACCESS_CODE', '')
162
163# is under development
164IS_DEV = os.environ.get('IS_DEV', False)
165
166
167# local settings for dev
168try:
169 from .local_settings import *
170except ImportError:
171 pass