1
0
forked from finn/site

set up wsgi/flask option in backend

This commit is contained in:
finn 2024-07-30 12:58:32 +00:00
parent 4bec4e9671
commit 9b79a3796b
4 changed files with 5 additions and 8 deletions

View File

@ -8,7 +8,7 @@ RUN target=/root/.cache/pip \
COPY . . COPY . .
ENV FLASK_APP giapp.py ENV FLASK_APP app.py
# This might be scary to leave on # This might be scary to leave on
#ENV FLASK_ENV development #ENV FLASK_ENV development

View File

@ -11,12 +11,9 @@ class DBManager:
#printf("DEBUG:" + envuser + envpass) #printf("DEBUG:" + envuser + envpass)
self.connection = mysql.connector.connect( self.connection = mysql.connector.connect(
user=envuser, user=envuser,
#user=user,
password=envpass, password=envpass,
#password=password,
host=host, # name of the mysql service as set in the docker compose file host=host, # name of the mysql service as set in the docker compose file
database=database database=database
#auth_plugin='mysql_native_password'
) )
self.cursor = self.connection.cursor() self.cursor = self.connection.cursor()
@ -46,9 +43,6 @@ def listBlog():
rec = conn.query_titles() rec = conn.query_titles()
response = '' response = ''
ict = ''
arg1 = ''
arg2 = ''
for c in rec: for c in rec:
response = response + '<div> Log: ' + c + '</div>' response = response + '<div> Log: ' + c + '</div>'
@ -58,7 +52,7 @@ def listBlog():
response = response + '<div>Delta: ' + dtFormatted + '</div>' response = response + '<div>Delta: ' + dtFormatted + '</div>'
return response return response
@server.route('/args-test', methods=['GET']) @server.route('/inconsequential-auth', methods=['GET'])
def listArgs(): def listArgs():
good_token_i = str(os.getenv("TOKEN_I")) good_token_i = str(os.getenv("TOKEN_I"))

View File

@ -1,3 +1,4 @@
Flask==3.0.3 Flask==3.0.3
Werkzeug==3.0.3 Werkzeug==3.0.3
mysql-connector-python mysql-connector-python
pyuwsgi

View File

@ -27,6 +27,8 @@ services:
context: backend context: backend
target: builder target: builder
restart: always restart: always
# Comment following line to use flask (1worker, dev), uncomment to use uwsgi (wsgi)
command: ["uwsgi", "--http", "0.0.0.0:8000", "--master", "-p", "4", "-w", "app:server"]
environment: environment:
- MYSQL_USER=flasku - MYSQL_USER=flasku
#- MYSQL_PASSWORD=flaskp #- MYSQL_PASSWORD=flaskp