]> git.datanom.net - liogui.git/blob - webapp/__init__.py
Completed User Administration
[liogui.git] / webapp / __init__.py
1 import os
2
3 from flask import Flask
4
5 #import logging
6
7 #logging.basicConfig(filename='message.log',
8 # level=logging.INFO,
9 # format='%(asctime)s %(levelname)s %(name)s %(threadName)s : %(message)s')
10
11 def create_app(test_config=None):
12 # create and configure the app
13 app = Flask(__name__, instance_relative_config=True)
14 app.config.from_mapping(
15 SECRET_KEY='dev',
16 DATABASE=os.path.join(app.instance_path, 'app.db'),
17 )
18
19 if test_config is None:
20 # load the instance config, if it exists, when not testing
21 app.config.from_pyfile('config.py', silent=True)
22 else:
23 # load the test config if passed in
24 app.config.from_mapping(test_config)
25
26 # ensure the instance folder exists
27 try:
28 os.makedirs(app.instance_path)
29 except OSError:
30 pass
31
32 from . import db
33 db.init_app(app)
34
35 from . import auth
36 app.register_blueprint(auth.bp)
37
38 from . import dashboard
39 app.register_blueprint(dashboard.bp)
40 app.add_url_rule('/', endpoint='index')
41
42 return app
This page took 0.374479 seconds and 6 git commands to generate.