Refactoring MySQL

This commit is contained in:
2024-06-02 19:03:58 +02:00
parent 8c11166397
commit 9fa7cfe867
2 changed files with 4 additions and 4 deletions

View File

@ -3,7 +3,7 @@ import sys
# noinspection PyPackageRequirements # noinspection PyPackageRequirements
def get_mysql(): def getMySQL():
""" """
Extrahiert die MySQL-Anmeldedaten aus ~/.my.cnf . \n Extrahiert die MySQL-Anmeldedaten aus ~/.my.cnf . \n
Funktioniert wahrscheinlich nur auf Linux, vor allem für den Server gedacht. Funktioniert wahrscheinlich nur auf Linux, vor allem für den Server gedacht.

View File

@ -4,7 +4,7 @@ from flask_sqlalchemy import SQLAlchemy
from flask_talisman import Talisman from flask_talisman import Talisman
from sqlalchemy import ForeignKey from sqlalchemy import ForeignKey
from getMySQL import get_mysql from getMySQL import getMySQL
import atexit import atexit
from flask_apscheduler import APScheduler from flask_apscheduler import APScheduler
@ -15,8 +15,8 @@ def create(testing: bool = False):
:return app: :return app:
""" """
app = Flask(__name__) app = Flask(__name__)
dbpw = get_mysql()[1] dbpw = getMySQL()[1]
dbun = get_mysql()[0] dbun = getMySQL()[0]
app.config['SECRET_KEY'] = 'SECRET_KEY_GOES_HERE' app.config['SECRET_KEY'] = 'SECRET_KEY_GOES_HERE'
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://' + dbun + ':' + dbpw + '@localhost/paulmrtn_DUALHUB' app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://' + dbun + ':' + dbpw + '@localhost/paulmrtn_DUALHUB'