aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/__init__.py24
-rw-r--r--app/dock-single.py11
-rw-r--r--app/dock_docker.py27
3 files changed, 47 insertions, 15 deletions
diff --git a/app/__init__.py b/app/__init__.py
index b4b9ea8..66efb0f 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -1,9 +1,26 @@
from flask import Flask
-# Config Values
+import configparser
+config = configparser.ConfigParser()
+config.read('config.ini')
+
+DB_HOST = config['DATABASE']['HOST']
+DB_PORT = config['DATABASE']['PORT']
+DB_USER = config['DATABASE']['USER']
+DB_PASSWORD = config['DATABASE']['PASSWORD']
+DB_NAME = config['DATABASE']['NAME']
+UPLOAD_FOLDER = config['FILES']['UPLOAD_FOLDER']
+
+"""
+# Hardcoded Values
# location where file uploads will be stored
UPLOAD_FOLDER = './app/static/uploads'
DB_HOST = 'navanspi.duckdns.org' #'navanspi.duckdns.org'
+DB_PORT = 3306
+DB_USER = 'curieweb'
+DB_PASSWORD = 'curie-web-russian-54'
+DB_NAME = 'curie'
+"""
import subprocess
import hashlib
@@ -16,10 +33,7 @@ try:
except:
None
-DB_PORT = 3306
-DB_USER = 'curieweb'
-DB_PASSWORD = 'curie-web-russian-54'
-DB_NAME = 'curie'
+
# needed for session security, the flash() method in this case stores the message
# in a session
SECRET_KEY = 'Sup3r$3cretkey'
diff --git a/app/dock-single.py b/app/dock-single.py
index a94f3e9..b5d9351 100644
--- a/app/dock-single.py
+++ b/app/dock-single.py
@@ -8,7 +8,16 @@ from collections import namedtuple
import mysql.connector as con
-mycon = con.connect(host='192.168.1.6',user="curieweb",password="curie-web-russian-54",port=3306,database="curie")
+import configparser
+config = configparser.ConfigParser()
+config.read('config.ini')
+
+try:
+ config['DATABASE']
+except KeyError:
+ config.read("../config.ini")
+
+mycon = con.connect(host=config['DATABASE']['HOST'],user=config['DATABASE']['USER'],password=config['DATABASE']['PASSWORD'],port=config['DATABASE']['PORT'],database=config['DATABASE']['NAME'])
mycursor = mycon.cursor()
sql_select_Query = "SELECT id,email,pdb,ligand_smile,ligand_name,description,date FROM curieweb WHERE pdb IS NOT NULL AND done=0 LIMIT 1"
diff --git a/app/dock_docker.py b/app/dock_docker.py
index a36648e..5869c21 100644
--- a/app/dock_docker.py
+++ b/app/dock_docker.py
@@ -1,6 +1,15 @@
import mysql.connector as con
-mycon = con.connect(host='192.168.1.6',user="curieweb",password="curie-web-russian-54",port=3306,database="curie")
+import configparser
+config = configparser.ConfigParser()
+config.read('config.ini')
+
+try:
+ config['DATABASE']
+except KeyError:
+ config.read("../config.ini")
+
+mycon = con.connect(host=config['DATABASE']['HOST'],user=config['DATABASE']['USER'],password=config['DATABASE']['PASSWORD'],port=config['DATABASE']['PORT'],database=config['DATABASE']['NAME'])
mycursor = mycon.cursor()
sql_select_Query = "select * from curieweb where done=0 LIMIT 1"
@@ -47,17 +56,17 @@ def email(zipArchive):
def get3DModel(protein,ligand):
try:
- import pymol2
+ import pymol2
except ImportError:
print("🤭 PyMOL 2 has not been installed correctly")
return None
- session = pymol2.PyMOL()
- session.start()
- cmd = session.cmd
- cmd.load(protein,"target")
- cmd.load(ligand,"ligand")
- cmd.save("model.dae")
- session.stop()
+ session = pymol2.PyMOL()
+ session.start()
+ cmd = session.cmd
+ cmd.load(protein,"target")
+ cmd.load(ligand,"ligand")
+ cmd.save("model.dae")
+ session.stop()
receptor_name = "protein.pdbqt"
ligand_name = "ligand.pdbqt"