fix: trying to still get db resolve to work

This commit is contained in:
iritmaximus
2023-02-05 15:18:41 +02:00
parent 7284df954a
commit 8faf769e97
3 changed files with 16 additions and 15 deletions
+2 -2
View File
@@ -7,5 +7,5 @@ RUN pip3 install -r requirements.txt
COPY . .
# CMD [ "gunicorn", "-w", "4", "flaskr:app", "-b", "0.0.0.0:5000", "--access-logfile", "'-'", "--error-logfile", "'-'"]
CMD [ "gunicorn", "-w", "4", "flaskr:app", "-b", "0.0.0.0:5000"]
CMD [ "gunicorn", "-w", "4", "flaskr:app", "-b", "0.0.0.0:5000", "--access-logfile", "-", "--error-logfile", "-"]
# CMD [ "gunicorn", "-w", "4", "flaskr:app", "-b", "0.0.0.0:5000"]
+5 -13
View File
@@ -19,8 +19,6 @@ services:
depends_on:
db:
condition: service_healthy
networks:
- flasknetwork
@@ -28,8 +26,6 @@ services:
image: postgres:bullseye
volumes:
- postgres_db:/var/lib/postgresql/data
networks:
- flasknetwork
env_file: .env
environment:
- POSTGRES_DB
@@ -44,15 +40,11 @@ services:
timeout: 2s
retries: 30
adminer:
image: adminer
restart: always
ports:
- 8080:8080
# adminer:
# image: adminer
# restart: always
# ports:
# - 8080:8080
volumes:
postgres_db:
networks:
flasknetwork:
driver: bridge
+9
View File
@@ -10,6 +10,15 @@ def test_db():
with flaskr.app.app_context():
sql = "DROP TABLE test"
flaskr.db.session.execute(sql)
sql = "CREATE TABLE IF NOT EXISTS test (id int primary key, greeting text)"
flaskr.db.session.execute(sql)
sql = "INSERT INTO test (id, greeting) VALUES (1, 'hello')"
flaskr.db.session.execute(sql)
result = flaskr.db.session.execute("SELECT * FROM test").fetchall()
print(result)