Added Docker configuration
This commit is contained in:
parent
dd7844e094
commit
35679695c5
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
venv
|
||||||
10
Dockerfile
10
Dockerfile
@ -2,15 +2,17 @@ FROM ubuntu:20.04
|
|||||||
|
|
||||||
MAINTAINER Abel Fokkinga "abel@fokkinga.com"
|
MAINTAINER Abel Fokkinga "abel@fokkinga.com"
|
||||||
|
|
||||||
RUN apt-get update -y && \
|
RUN apt-get update && apt-get upgrade -y && apt-get autoremove && apt-get autoclean
|
||||||
apt-get install -y python-pip python-dev
|
RUN apt install git python3 python3-pip -y --no-install-recommends
|
||||||
|
RUN apt install locales -y --no-install-recommends
|
||||||
|
RUN locale-gen en_US.UTF-8
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN pip install flask, requests, wtforms, json
|
RUN pip install flask requests wtforms
|
||||||
|
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
ENTRYPOINT [ "python" ]
|
ENTRYPOINT [ "python3" ]
|
||||||
|
|
||||||
CMD [ "main.py" ]
|
CMD [ "main.py" ]
|
||||||
|
|||||||
8
main.py
8
main.py
@ -40,16 +40,16 @@ def search_mp(product, postalcode, houseno, houseno_ext=''):
|
|||||||
print('Successfull GET Request')
|
print('Successfull GET Request')
|
||||||
return response.json()
|
return response.json()
|
||||||
|
|
||||||
|
|
||||||
def flash_results(results):
|
def flash_results(results):
|
||||||
for mp in results['meteringPoints']:
|
for mp in results['meteringPoints']:
|
||||||
|
print(mp['specialMeteringPoint'])
|
||||||
result = str(mp['ean']) + ';' + \
|
result = str(mp['ean']) + ';' + \
|
||||||
str(mp['product']) + ';' + \
|
str(mp['product']) + ';' + \
|
||||||
str(mp['address']['street']) + ';' + \
|
str(mp['address']['street']) + ';' + \
|
||||||
str(mp['address']['streetNumber']) + ';' + \
|
str(mp['address']['streetNumber']) + ';' + \
|
||||||
str(mp['address']['streetNumberAddition']) + ';' + \
|
str(mp['address']['streetNumberAddition'] if 'streetNumberAddition' in mp['address'] else '') + ';' + \
|
||||||
str(mp['address']['city']) + ';' + \
|
str(mp['address']['city']) + ';' + \
|
||||||
('Nee' if mp['specialMeteringPoint'] == 'False' else 'Ja') + ';' + \
|
('Nee' if mp['specialMeteringPoint'] is False else 'Ja') + ';' + \
|
||||||
str(mp['organisation']) + ';' + \
|
str(mp['organisation']) + ';' + \
|
||||||
str(mp['gridOperatorEan'])
|
str(mp['gridOperatorEan'])
|
||||||
flash(result, 'results')
|
flash(result, 'results')
|
||||||
@ -91,4 +91,4 @@ class ReusableForm(Form):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
with open('config.json') as json_data:
|
with open('config.json') as json_data:
|
||||||
config = json.load(json_data)
|
config = json.load(json_data)
|
||||||
app.run(debug=False, host='0.0.0.0')
|
app.run(debug=True, host='0.0.0.0')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user