-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
executable file
·67 lines (53 loc) · 1.76 KB
/
config.py
File metadata and controls
executable file
·67 lines (53 loc) · 1.76 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- coding: utf-8 -*-
"""
~~~~~~~~~~~~~~~~~~
flask web cofig module
@author guoweikuang
"""
import os
from const import MYSQL_URL
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
""" common config """
SECRET_KEY = 'GUO wei kuang blog'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
WEIBO_ADMIN = '673411814@qq.com'
WEIBO_MAIL_SUBJECT_PREFIX = '[Guoweikuang]'
WEIBO_MAIL_SENDER = '郭伟匡<15602200534@163.com>'
SQLALCHEMY_TRACK_MODIFICATIONS = True
MAIL_SERVER = 'smtp.163.com'
MAIL_PORT = 465
MAIL_USE_SSL = True
MAIL_USERNAME = '15602200534@163.com'
MAIL_PASSWORD = ''
BABEL_DEFAULT_LOCALE = 'zh_CN'
USERNAME = os.environ.get("WEIBO_USERNAME") or "root"
PASSWORD = os.environ.get("WEIBO_PASSWORD") or "2014081029"
MYSQL_URL = MYSQL_URL.format(username=USERNAME, password=PASSWORD)
#CELERY_BROKER_URL = 'redis://localhost:6379',
# CELERY_RESULT_BACKEND = 'redis://localhost:6379'
BABEL_DEFAULT_LOCALE = 'zh_CN'
def init_app(app):
pass
class DevelopmentConfig(Config):
""" development config """
DEBUG = True
SQLALCHEMY_DATABASE_URI = os.environ.get("DEV_DATABASE_URI") or MYSQL_URL
class TestingConfig(Config):
""" test environment config
need to set debug to True
"""
DEBUG = True
SQLALCHEMY_DATABASE_URI = os.environ.get("TEST_DATABASE_URI") or MYSQL_URL
class ProductionConfig(Config):
""" pruduction environment config
need to set debug to False.
"""
DEBUG = False
SQLALCHEMY_DATABASE_URI = os.environ.get("PRO_DATABASE_URI") or MYSQL_URL
config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig, # default to using development config
}