README.md updated and reorganized, Improved error handling for configparser and ldap manager, requirements.txt added

This commit is contained in:
ahmadbilalkhalid 2020-02-19 11:59:54 +05:00
commit e37592bdc6
9 changed files with 72 additions and 31 deletions

View file

@ -5,7 +5,7 @@ from uuid import uuid4
from flask import Flask, request
from flask_restful import Resource, Api
from werkzeug.exceptions import HTTPException
from config import etcd_client as client, config as config
from stripe_utils import StripeUtils
from schemas import (
@ -322,4 +322,15 @@ if __name__ == '__main__':
api.add_resource(UserRegisterPayment, '/user/register_payment')
api.add_resource(OrderList, '/order/list')
app.run(host='::', port=config['app']['port'], debug=True)
app.run(host='::', port=config.get('app', 'port', fallback=5000), debug=True)
@app.errorhandler(Exception)
def handle_exception(e):
app.logger.error(e)
# pass through HTTP errors
if isinstance(e, HTTPException):
return e
# now you're handling non-HTTP exceptions only
return {'message': 'Server Error'}, 500