Fixed Flask error handler set before app
This commit is contained in:
parent
0418afbdc5
commit
fb6f171e9b
1 changed files with 5 additions and 5 deletions
|
|
@ -30,11 +30,6 @@ import logging, sys
|
||||||
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
|
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
# Make errors more API friendly
|
|
||||||
@app.errorhandler(404)
|
|
||||||
def not_found(error):
|
|
||||||
return make_response(jsonify({'error': 'Not found'}), 404)
|
|
||||||
|
|
||||||
# Create the microscope object globally (common to all spawned server threads)
|
# Create the microscope object globally (common to all spawned server threads)
|
||||||
microscope = Microscope(
|
microscope = Microscope(
|
||||||
StreamingCamera(),
|
StreamingCamera(),
|
||||||
|
|
@ -44,6 +39,11 @@ microscope = Microscope(
|
||||||
# Create flask app
|
# Create flask app
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
# Make errors more API friendly
|
||||||
|
@app.errorhandler(404)
|
||||||
|
def not_found(error):
|
||||||
|
return make_response(jsonify({'error': 'Not found'}), 404)
|
||||||
|
|
||||||
# Some useful functions
|
# Some useful functions
|
||||||
def uri(suffix, base='/api/v1'):
|
def uri(suffix, base='/api/v1'):
|
||||||
return base + suffix
|
return base + suffix
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue