forked from 123woscc/commentbox
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (22 loc) · 783 Bytes
/
Copy pathapp.py
File metadata and controls
31 lines (22 loc) · 783 Bytes
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
# coding=utf-8
from collections import OrderedDict
from flask import Flask
from werkzeug.wsgi import DispatcherMiddleware
import config
from views import backend
from views.api import 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)