Webcam support to use it as a photomaton ( photobooth ) #2
@ -51,6 +51,7 @@ app.secret_key = configuration_file["secrets"]["flask_secret_key"]
|
|||||||
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
||||||
app.config['ALLOWED_EXTENSIONS'] = ALLOWED_EXTENSIONS
|
app.config['ALLOWED_EXTENSIONS'] = ALLOWED_EXTENSIONS
|
||||||
app.config['MAX_CONTENT_LENGTH'] = 3 * 1000 * 1000 # Maximum 3Mb for a file upload
|
app.config['MAX_CONTENT_LENGTH'] = 3 * 1000 * 1000 # Maximum 3Mb for a file upload
|
||||||
|
app.config['TEMPLATES_AUTO_RELOAD'] = True
|
||||||
|
|
||||||
# Printer connection
|
# Printer connection
|
||||||
# Uses the class defined in the printer.py file
|
# Uses the class defined in the printer.py file
|
||||||
@ -64,7 +65,7 @@ web = Web(app, printer)
|
|||||||
limiter = Limiter(
|
limiter = Limiter(
|
||||||
app,
|
app,
|
||||||
key_func=get_remote_address,
|
key_func=get_remote_address,
|
||||||
default_limits=["200 per day", "50 per hour"]
|
default_limits=["1500 per day", "500 per hour"]
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
@ -73,6 +74,12 @@ def index():
|
|||||||
app.logger.debug("Loading index")
|
app.logger.debug("Loading index")
|
||||||
return render_template('index.html')
|
return render_template('index.html')
|
||||||
|
|
||||||
|
@app.route('/webcam')
|
||||||
|
@limiter.limit("1/second", override_defaults=False)
|
||||||
|
def webcam():
|
||||||
|
app.logger.debug("Loading webcam interface")
|
||||||
|
return render_template('webcam.html')
|
||||||
|
|
||||||
# API routes
|
# API routes
|
||||||
# The api has the following methods
|
# The api has the following methods
|
||||||
# api/print/{sms,img,letter,qr,barcode}
|
# api/print/{sms,img,letter,qr,barcode}
|
||||||
|
Loading…
Reference in New Issue
Block a user