Conditions | 1 |
Total Lines | 27 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | from flask import Flask |
||
9 | def create_app(config_filename): |
||
10 | app = Flask(__name__) |
||
11 | app.config.from_object(app_config[config_filename]) |
||
12 | #bcrypt = Bcrypt(app) |
||
13 | |||
14 | |||
15 | #setup flask-jwt-extended extension |
||
16 | app.config['JWT_SECRET_KEY'] = 'secret' |
||
17 | jwt = JWTManager(app) |
||
18 | |||
19 | from app import api_bp |
||
20 | app.register_blueprint(api_bp, url_prefix='/api/v1') |
||
21 | |||
22 | |||
23 | @app.errorhandler(403) |
||
24 | def forbidden(error): |
||
25 | return "Your are not authorized to view this page", 403 |
||
26 | |||
27 | @app.errorhandler(404) |
||
28 | def page_not_found(error): |
||
29 | return "The resource you are looking for is not available", 404 |
||
30 | |||
31 | @app.errorhandler(500) |
||
32 | def internal_server_error(error): |
||
33 | return "The server encountered internal eror", 500 |
||
34 | |||
35 | return app |
||
36 | |||
41 | app.run(host='0.0.0.0', port=port) |