mirror of
https://github.com/marcel-dempers/docker-development-youtube-series.git
synced 2025-06-06 17:01:30 +00:00
updates
This commit is contained in:
parent
f796c4bfc6
commit
d47976ffa8
@ -185,7 +185,7 @@ our application and needs grow. Best is to use a `requirements.txt` file.
|
||||
Let's create a `requirements.txt` file:
|
||||
|
||||
```
|
||||
Flask == 2.0.1
|
||||
Flask == 2.0.2
|
||||
```
|
||||
|
||||
We can install our dependencies using:
|
||||
@ -418,10 +418,10 @@ WORKDIR /work
|
||||
|
||||
FROM dev as runtime
|
||||
WORKDIR /app
|
||||
COPY requirements.txt /app/
|
||||
COPY ./src/requirements.txt /app/
|
||||
RUN pip install -r /app/requirements.txt
|
||||
|
||||
COPY ./src/ /app
|
||||
COPY ./src/app.py /app/app.py
|
||||
ENV FLASK_APP=app.py
|
||||
|
||||
CMD flask run -h 0.0.0 -p 5000
|
||||
|
@ -4,10 +4,11 @@ WORKDIR /work
|
||||
|
||||
FROM dev as runtime
|
||||
WORKDIR /app
|
||||
COPY requirements.txt /app/
|
||||
|
||||
COPY ./src/requirements.txt /app/
|
||||
RUN pip install -r /app/requirements.txt
|
||||
|
||||
COPY ./src/ /app
|
||||
COPY ./src/app.py /app/app.py
|
||||
ENV FLASK_APP=app.py
|
||||
|
||||
CMD flask run -h 0.0.0 -p 5000
|
@ -1 +0,0 @@
|
||||
Flask == 2.0.1
|
@ -24,10 +24,11 @@ def getCustomers():
|
||||
|
||||
def getCustomer(customerID):
|
||||
customers = getCustomers()
|
||||
|
||||
if customerID in customers:
|
||||
return customers[customerID]
|
||||
else:
|
||||
return {}
|
||||
else:
|
||||
return {}
|
||||
|
||||
def updateCustomers(customers):
|
||||
with open(dataPath, 'w', newline='') as customerFile:
|
||||
@ -44,6 +45,7 @@ def get_customers():
|
||||
@app.route("/get/<string:customerID>", methods=['GET'])
|
||||
def get_customer(customerID):
|
||||
customer = getCustomer(customerID)
|
||||
|
||||
if customer == {}:
|
||||
return {}, 404
|
||||
else:
|
||||
@ -59,7 +61,7 @@ def add_customer():
|
||||
return "firstName required", 400
|
||||
if "lastName" not in jsonData:
|
||||
return "lastName required", 400
|
||||
|
||||
|
||||
customers = getCustomers()
|
||||
customers[jsonData["customerID"]] = Customer( jsonData["customerID"], jsonData["firstName"], jsonData["lastName"]).__dict__
|
||||
updateCustomers(customers)
|
||||
|
1
python/introduction/part-4.http/src/requirements.txt
Normal file
1
python/introduction/part-4.http/src/requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
Flask == 2.0.2
|
Loading…
x
Reference in New Issue
Block a user