[chronojump-server] flask DB connection read from config
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump-server] flask DB connection read from config
- Date: Mon, 15 May 2017 18:18:14 +0000 (UTC)
commit db02e2cd77e09f62b3b584a54754144f67d47dec
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon May 15 20:14:31 2017 +0200
flask DB connection read from config
chronojump-flask/chronojump_server.py | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/chronojump-flask/chronojump_server.py b/chronojump-flask/chronojump_server.py
index fd50f89..7df81f8 100644
--- a/chronojump-flask/chronojump_server.py
+++ b/chronojump-flask/chronojump_server.py
@@ -3,14 +3,18 @@ from flaskext.mysql import MySQL
import subprocess
import os
from werkzeug import secure_filename
+import ConfigParser
+config = ConfigParser.ConfigParser()
+config.read('/etc/chronojump.conf')
mysql = MySQL()
app = Flask(__name__)
-app.config['MYSQL_DATABASE_USER'] = 'root'
-app.config['MYSQL_DATABASE_PASSWORD'] = '' #TODO change this
-app.config['MYSQL_DATABASE_DB'] = 'chronojump'
-app.config['MYSQL_DATABASE_HOST'] = 'localhost'
+app.config['MYSQL_DATABASE_USER'] = config.get("db","user")
+app.config['MYSQL_DATABASE_PASSWORD'] = config.get("db","password")
+app.config['MYSQL_DATABASE_DB'] = config.get("db","name")
+app.config['MYSQL_DATABASE_HOST'] = config.get("db","server")
+
mysql.init_app(app)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]