blob: f9f32a29f6238adabd402ab523e76a16955e56cc (
plain) (
blame)
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
35
36
37
38
|
import os
from flask import Flask
def create_app(test_config=None):
# create and configure the app.
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY='dev',
DATABASE=os.path.join(app.instance_path, 'nfsw.sqlite')
)
if test_config is None:
# load instance's config if it exists.
app.config.from_pyfile('config.py', silent=True)
else:
app.config.from_object(test_config)
try:
os.makedirs(app.instance_path)
except:
pass
# register database commands.
from nfsw import db
db.init_app(app)
# register auth blueprint
from nfsw import auth
app.register_blueprint(auth.bp)
return app
|