forked from 5-Software-Systems/e-portfolio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
36 lines (26 loc) · 917 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
35
36
import sys
import pytest
from flask import Flask, render_template
from config import config
from api import blueprint, db, flask_bcrypt
from api.main.util.funcs import rel_path
def create_app():
app = Flask(
import_name='__main__',
static_folder=rel_path('app/build', __file__),
template_folder=rel_path('app/build', __file__),
static_url_path='/'
)
app.config.from_object(config)
for attr in [a for a in dir(config) if not a.startswith('__')]:
print(f'{attr:<35} = {getattr(config, attr)}', file=sys.stderr)
db.init_app(app)
flask_bcrypt.init_app(app)
app.register_blueprint(blueprint, url_prefix='/api')
@app.route('/')
def index():
return render_template('index.html', token='Hello World')
@app.errorhandler(404)
def not_found(e):
return render_template('index.html', token='Hello World')
return app