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