Make message more clear if file is not found in create_image_from_file view and added gunicorn

This commit is contained in:
ahmadbilalkhalid 2019-07-02 12:45:13 +05:00
parent 0253aa9afc
commit 084da2eee5
3 changed files with 13 additions and 2 deletions

View file

@ -12,6 +12,7 @@ requests = "*"
flask = "*" flask = "*"
flask-restful = "*" flask-restful = "*"
etcd3 = "*" etcd3 = "*"
gunicorn = "*"
[requires] [requires]
python_version = "3.7" python_version = "3.7"

10
Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "8793670eeaec12ab75f38686e67ba0c4f7d27a7b6da26d9c692b55621c865f63" "sha256": "87f5447c7fa8d96dacc7c638075cc31842ef676f6d1c35214e1960572d44e929"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@ -104,6 +104,14 @@
], ],
"version": "==1.21.1" "version": "==1.21.1"
}, },
"gunicorn": {
"hashes": [
"sha256:aa8e0b40b4157b36a5df5e599f45c9c76d6af43845ba3b3b0efe2c70473c2471",
"sha256:fa2662097c66f920f53f70621c6c58ca4a3c4d3434205e608e121b5b3b71f4f3"
],
"index": "pypi",
"version": "==19.9.0"
},
"idna": { "idna": {
"hashes": [ "hashes": [
"sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407",

View file

@ -101,7 +101,9 @@ class CreateImage(Resource):
file_entry = client.get(f"/v1/files/{image_file_uuid}") file_entry = client.get(f"/v1/files/{image_file_uuid}")
if file_entry is None: if file_entry is None:
return {"Message": "Image File Not Found"}, 400 return {
"Message":
f"Image File with uuid '{image_file_uuid}' Not Found"}, 400
file_entry_value = json.loads(file_entry.value) file_entry_value = json.loads(file_entry.value)