added loggin of req ip
This commit is contained in:
parent
b6f8f8f234
commit
3834c1bf3e
|
|
@ -4,3 +4,5 @@ data/recs.json
|
|||
backup.sql
|
||||
|
||||
app/data/
|
||||
|
||||
app/application/__pycache__/
|
||||
|
|
|
|||
|
|
@ -5,15 +5,17 @@ import os
|
|||
from json import dumps
|
||||
import application.endpoints as endpoints
|
||||
import application.config as config
|
||||
import logging
|
||||
|
||||
app = Flask(__name__)
|
||||
api = Api(app, version='1', contact={"name":""}, license={"name":"Online Dienst Dokumentation"}, api_spec_url='/api/swagger')
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
api.add_resource(endpoints.RecipeList,'/api/v1/recipe/')
|
||||
api.add_resource(endpoints.Images,'/api/v1/images/<string:id>')
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
"""serve the ui"""
|
||||
app.logger.info(f" request from {request.remote_addr}")
|
||||
return render_template("index.html")
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -44,6 +44,7 @@ class Images(Resource):
|
|||
session = Session()
|
||||
image = session.query(Recipe.img).filter(Recipe.recipe_id == id).first()[0]
|
||||
image = base64.b64decode(image)
|
||||
session.close()
|
||||
return flask.Response(image, mimetype='image/png')
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue