TO_BE_REFINED
DISCLAIMER: This module has been created in a hurry so it not at the same standards of the others.
This module will create a python3 flask project (with docker and testing).
You will need to call the script passing as a parameter the new project path:
./script.sh <path-to-dir>
For example:
./script.sh /tmp/jecnua-new-project
To run the python app locally (not in docker):
pipenv install
export FLASK_APP=src/app.py
FLASK_APP=src/app.py pipenv run flask run
Build and run docker:
docker build . -t python-test:latest
docker rm -f python-test
docker run --rm --name python-test -d -p 5000:5000 python-test:latest
How to build url with variables:
Different error code:
Validate https://pythonhosted.org/Flask-Inputs/
-
http://flask.pocoo.org/docs/0.12/api/#flask.Request.is_json too strict
if request.method == 'GET': return jsonify(message='Hello '+name) http://flask.pocoo.org/docs/0.12/api/#flask.json.jsonify
input_recieved = request.get_json(force=True)
This will return malformed if it's empty or not json.
app.logger.error(request.is_json) # Too strict as it's not specified
Limitation of cli and endpoint.
- Add a version for lambdas
- Add travis
- Add acqua docker scan
- Allow to choose the project name
- Import all new learning