forked from YoRyan/knowledge-seeker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
32 lines (22 loc) · 826 Bytes
/
__init__.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
from os import environ, makedirs
from pathlib import Path
import flask
def create_app(test_config=None):
app = flask.Flask(__name__, instance_relative_config=True)
app.config.from_pyfile('config.py')
app.config['DEV'] = 'FLASK_ENV' in environ and environ['FLASK_ENV'] == 'development'
for key in ['LIBRARY', 'PIL_FONT', 'FF_FONT_DIR']:
app.config[key] = Path(app.instance_path)/app.config[key]
try:
makedirs(app.instance_path)
except OSError:
pass
import knowledgeseeker.clips as clips
app.register_blueprint(clips.bp)
import knowledgeseeker.webui as webui
app.register_blueprint(webui.bp)
import knowledgeseeker.library as library
library.init_app(app)
import knowledgeseeker.database as database
database.init_app(app)
return app