-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhushixia
committed
Aug 16, 2018
1 parent
8535c69
commit 66c3da1
Showing
1 changed file
with
10 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
from flask import Flask | ||
from flask.ext.sqlalchemy import SQLAlchemy | ||
from flask.ext.wtf import CSRFProtect | ||
from redis import StrictRedis | ||
|
||
|
||
class Config(object):#项目的配置 | ||
DEBUG = True | ||
#为数据库添加配置 | ||
SQLAlchemy_DATABASE_URI = "mysql://root:[email protected]:3306/information27" | ||
SQLALCHEMY_TRACK_MODIFICATIONS = False | ||
#Redis的配置 | ||
REDIS_HOST = "127.0.0.1" | ||
REDIS_PORT = 6379 | ||
|
||
app = Flask(__name__) | ||
#加载配置 | ||
app.config.from_object(Config) | ||
|
||
#初始化数据库 | ||
db = SQLAlchemy(app) | ||
#初始化redis存储对象 | ||
redis_store = StrictRedis(host=Config.REDIS_HOST, port=Config.REDIS_PORT) | ||
#开启当前项目csrf保护,只做服务验证工作 | ||
CSRFProtect(app) | ||
|
||
|
||
|
||
@app.route("/") | ||
|