-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
65 lines (52 loc) · 1.86 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
53
54
55
56
57
58
59
60
61
62
63
64
65
# -*- coding: utf-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'a n string haha aha'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
FLASK_MAIL_SUBJECT_PREFIX = '[glrh11]'
FLASK_MAIL_SENDER = 'glrh11 <glrh11_test@163.com>'
FLASK_ADMIN = os.environ.get('FLASK_ADMIN') or 'glrh11_test@163.com'
DEFAULT_NAME = u'佚名'
# locale
BABEL_DEFAULT_LOCALE = 'zh_Hans_CN'
HEAD_PORTRAIT = 'http://o9hjg7h8u.bkt.clouddn.com/head_portrait.png-headPortraitCrop'
# QINIU related
QINIU_ACCESS_KEY = 'NLbTTwY2zwZBHIh6sIdzlVruMV-eUDkXUnw-Ko87'
# it should be taken as env vars
QINIU_SECRET_KEY = 'LHCPI62Exu9m1W7zpwOzbqMSvm21hXGgjk4uXWo7'
QINIU_BUCKET_NAME = 'flask-test'
QINIU_PATH_PREFIX = 'http://o9hjg7h8u.bkt.clouddn.com/'
# pagination
FLASKY_POSTS_PER_PAGE = 20
FLASKY_FOLLOWERS_PER_PAGE = 20
FLASKY_COMMENTS_PER_PAGE = 20
# email
MAIL_SERVER = 'smtp.163.com'
MAIL_PORT = 25
MAIL_USE_TLS = True
MAIL_USERNAME = 'glrh11@163.com'
MAIL_PASSWORD = 'woshishouquanma1' #'os.environ.get('MAIL_PASSWORD')'
# locale
# Refer: https://phraseapp.com/blog/posts/python-localization-for-flask-applications/
LANGUAGES = {
'en': 'English',
'zh': 'Chinese',
}
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'postgresql://postgres:qwe123@localhost:5432/xiangjianhuan'
class TestingConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or 'sqlite:///' + os.path.join(basedir, 'data-test.sqlite')
class ProductionConfig(Config):
SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI') or 'postgresql://postgres:qwe123@localhost:5432/xiangjianhuan'
config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}