Skip to content

Commit 0201753

Browse files
author
Arvi Shankar
committed
changed structure for flask app
1 parent 1f57abd commit 0201753

File tree

6 files changed

+17
-15
lines changed

6 files changed

+17
-15
lines changed

python-flask/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ WORKDIR /usr/src/app
55
# install requirements
66
# this way when you build you won't need to install again
77
# and since COPY is cached we don't need to wait
8-
COPY requirements.txt /tmp/requirements.txt
8+
COPY ./app/src/requirements.txt /tmp/requirements.txt
99
RUN pip3 install -r /tmp/requirements.txt
1010

1111
COPY app /usr/src/app
1212

1313
# App port number is configured through the gunicorn config file
14-
CMD ["gunicorn", "--config", "gunicorn_config.py", "server:app"]
14+
CMD ["gunicorn", "--config", "./conf/gunicorn_config.py", "src:app"]

python-flask/app/server.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

python-flask/app/src/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from flask import Flask
2+
3+
4+
app = Flask(__name__)
5+
6+
from .server import *
File renamed without changes.

python-flask/app/src/server.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from src import app
2+
from flask import jsonify, request
3+
import requests
4+
import json
5+
6+
7+
@app.route("/")
8+
def hello():
9+
return json.dumps({"message":"Hello World!"})

0 commit comments

Comments
 (0)