|
|
@@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/2.1/ref/settings/
|
|
|
|
|
|
import os
|
|
|
import datetime
|
|
|
+import json
|
|
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
@@ -23,7 +24,15 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
SECRET_KEY = '$rs)*w)9gh)nkf1=@r$2xguf1b(qz8ba!%hm8lwt54ti3_da^b'
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
|
-DEBUG = False
|
|
|
+DEBUG = True
|
|
|
+
|
|
|
+if DEBUG == True:
|
|
|
+ config_path = "test.json"
|
|
|
+else:
|
|
|
+ config_path = "formal.json"
|
|
|
+with open(config_path,"r") as f:
|
|
|
+ config_data = f.read()
|
|
|
+config = json.loads(config_data)
|
|
|
|
|
|
ALLOWED_HOSTS = ['*']
|
|
|
|
|
|
@@ -78,50 +87,28 @@ WSGI_APPLICATION = 'bigdataAPI.wsgi.application'
|
|
|
# Database
|
|
|
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
|
|
|
|
|
|
-
|
|
|
-# USER_CONFIG = {
|
|
|
-# 'mysql': {
|
|
|
-# 'host': 'localhost',
|
|
|
-# 'user': 'root',
|
|
|
-# 'pwd': 'yfkj@6020',
|
|
|
-# 'port': 3306
|
|
|
-# },
|
|
|
-# 'mongodb': {
|
|
|
-# 'host': 'localhost',
|
|
|
-# 'user': 'root',
|
|
|
-# 'pwd': 'yfkj@6020',
|
|
|
-# 'port': 27017
|
|
|
-# }
|
|
|
-# }
|
|
|
-USER_CONFIG = {
|
|
|
- 'mysql': {
|
|
|
- 'host': 'localhost',
|
|
|
- 'user': 'root',
|
|
|
- 'pwd': 'yfkj@6020',
|
|
|
- 'port': 61882
|
|
|
- },
|
|
|
- 'mongodb': {
|
|
|
- 'host': 'localhost',
|
|
|
- 'user': 'root',
|
|
|
- 'pwd': 'yfkj@6020',
|
|
|
- 'port': 57017
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
DATABASES = {
|
|
|
'default': {
|
|
|
'ENGINE': 'django.db.backends.mysql',
|
|
|
'NAME': 'bigdata_api',
|
|
|
- 'USER': 'api',
|
|
|
- 'PASSWORD': 'yfkj@6020',
|
|
|
- 'HOST': '127.0.0.1',
|
|
|
- 'PORT': 61882,
|
|
|
- # 'PORT': 3306,
|
|
|
+ 'USER': config["mysql"]["user"],
|
|
|
+ 'PASSWORD': config["mysql"]["pwd"],
|
|
|
+ 'HOST': config["mysql"]["host"],
|
|
|
+ 'PORT': config["mysql"]["port"],
|
|
|
'OPTIONS': {'charset': 'utf8mb4'}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+CACHES = {
|
|
|
+ 'default': {
|
|
|
+ 'BACKEND': 'django_redis.cache.RedisCache',
|
|
|
+ "LOCATION": config["redis"]["url"],
|
|
|
+ "OPTIONS": {
|
|
|
+ "CLIENT_CLASS": "django_redis.client.DefaultClient",
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
# Password validation
|
|
|
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
|
|
|
|
|
|
@@ -175,11 +162,4 @@ REST_FRAMEWORK = {
|
|
|
|
|
|
JWT_AUTH = {
|
|
|
'JWT_EXPIRATION_DELTA': datetime.timedelta(days=1),
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-CACHES = {
|
|
|
- 'default': {
|
|
|
- 'BACKEND': 'uwsgicache.UWSGICache',
|
|
|
- }
|
|
|
}
|