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