forked from JFluo2011/commentbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
34 lines (24 loc) · 792 Bytes
/
app.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
# coding=utf-8
from collections import OrderedDict
from flask import Flask
from werkzeug.wsgi import DispatcherMiddleware
import config
from views import backend, json_api
from ext import db, mako
from libs.rdstore import cache
from libs.session import RedisSessionInterface
def create_app():
app = Flask(__name__, template_folder='templates',
static_folder='static')
app.config.from_object(config)
mako.init_app(app)
db.init_app(app)
app.session_interface = RedisSessionInterface(cache)
app.register_blueprint(backend.bp)
app.wsgi_app = DispatcherMiddleware(app.wsgi_app, OrderedDict((
('/j', json_api),
)))
return app
app = create_app()
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8100, debug=app.debug)