Started with web application
This commit is contained in:
parent
7beda138c5
commit
75f2365024
40 changed files with 17382 additions and 0 deletions
11
backend/Dockerfile
Normal file
11
backend/Dockerfile
Normal file
|
@ -0,0 +1,11 @@
|
|||
FROM python
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY /src .
|
||||
|
||||
CMD [ "flask", "run" ]
|
15
backend/Dockerfile.prod
Normal file
15
backend/Dockerfile.prod
Normal file
|
@ -0,0 +1,15 @@
|
|||
FROM python
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get -y update && apt-get -y upgrade
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN apt-get -y install sqlite3
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY /src .
|
||||
|
||||
CMD [ "python", "app.py" ]
|
6
backend/requirements.txt
Normal file
6
backend/requirements.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
click==8.0.1
|
||||
Flask==2.0.1
|
||||
itsdangerous==2.0.1
|
||||
Jinja2==3.0.1
|
||||
MarkupSafe==2.0.1
|
||||
Werkzeug==2.0.1
|
30
backend/src/app.py
Normal file
30
backend/src/app.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import os
|
||||
import time
|
||||
import flask
|
||||
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
# Read environment variables
|
||||
if "DEBUG" in os.environ and os.environ["DEBUG"] == 'yes':
|
||||
debug = True
|
||||
else:
|
||||
debug = False
|
||||
if "HOST" in os.environ:
|
||||
host = os.environ["HOST"]
|
||||
else:
|
||||
host = '0.0.0.0'
|
||||
if "PORT" in os.environ:
|
||||
port = int(os.environ["PORT"])
|
||||
else:
|
||||
port = 5000
|
||||
|
||||
@app.route('/time')
|
||||
def get_current_time():
|
||||
return {'time': time.time()}
|
||||
|
||||
@app.route('/api/generate-letter', methods=['POST'])
|
||||
def create_letter():
|
||||
req = flask.request.get_json(force=True)
|
||||
print(req)
|
||||
ret = {'message': 'Erfolgreich'}
|
||||
return ret, 200
|
Loading…
Add table
Add a link
Reference in a new issue