-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
59 lines (50 loc) · 1.56 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
# -*- coding:utf-8 -*-
from datetime import timedelta
from celery.schedules import crontab
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config():
DEBUG = True
SESSION_TYPE = 'filesystem'
SECRET_KEY = '######################'
SQLALCHEMY_TRACK_MODIFICATIONS = False
# mysql自动提交
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
# mysql配置
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://xxx:xxxx@127.0.0.1/xxx?charset=utf8'
# 打印sql
SQLALCHEMY_ECHO = True
# 邮件配置
MAIL_SERVER = '###############'
MAIL_PORT = 25
MAIL_USE_TLS = False
MAIL_USE_SSL = False
MAIL_DEBUG = True
MAIL_USERNAME = '####################'
MAIL_PASSWORD = '###################'
MAIL_SENDER = '#############'
# cache配置
CACHE_TYPE = 'filesystem' # 缓存类型
CACHE_DIR = basedir+'/tmp' # 缓存目录
CACHE_DEFAULT_TIMEOUT = 5*60 # 默认过期时间
# celery配置
CELERY_BROKER_URL = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/1'
CELERY_ALWAYS_EAGER = True
CELERYBEAT_SCHEDULE = {
'TimedTask': {
'task': 'app.tasks.printy.TimedTask',
'schedule': crontab(minute=35, hour=11),
'args': ()
},
}
# celery时区
CELERY_TIMEZONE = 'Asia/Shanghai'
# 文章分页数
POSTS_PER_PAGE = 15
# 文件上传设置
UPLOAD_FOLDER = basedir + "/app/static/images/avatar"
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
@staticmethod
def init_app(app):
pass