Commit a750056a authored by Ossi Laine's avatar Ossi Laine
Browse files

Fix connection issues in dockerized environment

parent 4acd3fa7
...@@ -23,3 +23,7 @@ COPY messages.pot /srv/app ...@@ -23,3 +23,7 @@ COPY messages.pot /srv/app
RUN mkdir logs RUN mkdir logs
RUN mkdir app/static/embody_drawings
RUN mkdir app/static/embody_images
RUN mkdir app/static/experiment_stimuli
...@@ -55,7 +55,9 @@ class MyDB(object): ...@@ -55,7 +55,9 @@ class MyDB(object):
self._db_connection = mariadb.connect( self._db_connection = mariadb.connect(
user=Config.MYSQL_USER, user=Config.MYSQL_USER,
password=Config.MYSQL_PASSWORD, password=Config.MYSQL_PASSWORD,
database=Config.MYSQL_DB database=Config.MYSQL_DB,
host=Config.MYSQL_SERVER,
auth_plugin='mysql_native_password'
) )
self._db_cur = self._db_connection.cursor() self._db_cur = self._db_connection.cursor()
......
...@@ -11,8 +11,7 @@ class Config(object): ...@@ -11,8 +11,7 @@ class Config(object):
MYSQL_SERVER = config('MYSQL_SERVER') MYSQL_SERVER = config('MYSQL_SERVER')
MYSQL_DB = config('MYSQL_DB') MYSQL_DB = config('MYSQL_DB')
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://'+MYSQL_USER+':' + \ SQLALCHEMY_DATABASE_URI = f"mysql+pymysql://{MYSQL_USER}:{MYSQL_PASSWORD}@{MYSQL_SERVER}/{MYSQL_DB}?charset=utf8mb4"
MYSQL_PASSWORD+'@'+MYSQL_SERVER+'/'+MYSQL_DB+'?charset=utf8mb4'
SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_TRACK_MODIFICATIONS = False
......
...@@ -2,4 +2,3 @@ MYSQL_USER=rating ...@@ -2,4 +2,3 @@ MYSQL_USER=rating
MYSQL_PASSWORD=rating_passwd MYSQL_PASSWORD=rating_passwd
MYSQL_SERVER=db MYSQL_SERVER=db
MYSQL_DB=rating_db MYSQL_DB=rating_db
...@@ -26,8 +26,6 @@ services: ...@@ -26,8 +26,6 @@ services:
depends_on: depends_on:
- db - db
command: sh -c "gunicorn run:app -b 0.0.0.0:8000 -k gevent --worker-connections=1000 --workers=1 --log-level debug -t 180" command: sh -c "gunicorn run:app -b 0.0.0.0:8000 -k gevent --worker-connections=1000 --workers=1 --log-level debug -t 180"
#volumes: FOR DEV
#- ./application:/srv/app
db: db:
image: mysql image: mysql
......
...@@ -13,7 +13,6 @@ gevent==1.4.0 ...@@ -13,7 +13,6 @@ gevent==1.4.0
greenlet==0.4.15 greenlet==0.4.15
gunicorn==19.9.0 gunicorn==19.9.0
matplotlib==3.0.3 matplotlib==3.0.3
mysql-connector==2.2.9
networkx==2.2 networkx==2.2
numpy==1.16.2 numpy==1.16.2
Pillow Pillow
...@@ -32,3 +31,5 @@ Werkzeug==0.14.1 ...@@ -32,3 +31,5 @@ Werkzeug==0.14.1
WTForms==2.2.1 WTForms==2.2.1
WTForms-SQLAlchemy==0.1 WTForms-SQLAlchemy==0.1
cryptography cryptography
mysql-connector-python
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment