-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
52 lines (43 loc) · 1.77 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import os
env = os.getenv('ENV')
if env == 'production':
USERNAME = os.getenv('USERNAME') or 'root'
PASSWORD = os.getenv('PASSWORD') or 'root'
HOST = os.getenv('HOST') or 'mysql'
PORT = os.getenv('PORT') or 3306
DATABASE = os.getenv('DATABASE') or 'rest'
else:
USERNAME = os.getenv('USERNAME') or 'root'
PASSWORD = os.getenv('PASSWORD') or 'root'
HOST = '127.0.0.1'
PORT = os.getenv('PORT') or 3306
DATABASE = os.getenv('DATABASE') or 'rest'
class BaseConfig:
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{}:{}@{}: \
{}/{}?charset=utf8'.format(USERNAME, PASSWORD, HOST, PORT,
DATABASE)
SQLALCHEMY_TRACK_MODIFICATIONS = False
PAGE_ITEMS = 10
UPLOAD_FOLDER = os.path.join(os.getcwd(), 'dist', 'static', 'images')
SECRET_KEY = 'you will never guess me'
RESTFUL_JSON = dict(ensure_ascii=False)
HOST = 'http://127.0.0.1:5000'
class ProConfig:
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{}:{}@{}: \
{}/{}?charset=utf8'.format(USERNAME, PASSWORD, HOST, PORT,
DATABASE)
SQLALCHEMY_TRACK_MODIFICATIONS = False
PAGE_ITEMS = 10
UPLOAD_FOLDER = os.path.join(os.getcwd(), 'dist', 'static', 'images')
SECRET_KEY = 'you will never guess me'
RESTFUL_JSON = dict(ensure_ascii=False)
HOST = 'https://buglan.org'
class TestConfig:
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(
os.path.abspath('.'), 'tests/test.db')
SQLALCHEMY_TRACK_MODIFICATIONS = False
PAGE_ITEMS = 10
UPLOAD_FOLDER = os.path.join(os.getcwd(), 'dist', 'static', 'images')
SECRET_KEY = 'you will never guess me'
RESTFUL_JSON = dict(ensure_ascii=False)
config = {'dev': BaseConfig, 'pro': ProConfig, 'test': TestConfig}