moriire commited on
Commit
ca6a637
1 Parent(s): 75121fe

Update database.py

Browse files
Files changed (1) hide show
  1. database.py +11 -1
database.py CHANGED
@@ -2,9 +2,19 @@ from sqlalchemy import create_engine
2
  from sqlalchemy.ext.declarative import declarative_base
3
  from sqlalchemy.orm import sessionmaker
4
  #from config import settings
 
5
  import os
6
- db_url = os.environ.get("DATABASE_URL", "")
 
 
7
 
 
 
 
 
 
 
 
8
  #database = databases.Database(settings.db_url)
9
  SQLALCHEMY_DATABASE_URL = "ibmabdulsalam.mysql.pythonanywhere-services.com" #"sqlite:///./sql_app.db"
10
  #SQLALCHEMY_DATABASE_URL = db_url #"postgresql://user:password@postgresserver/db"
 
2
  from sqlalchemy.ext.declarative import declarative_base
3
  from sqlalchemy.orm import sessionmaker
4
  #from config import settings
5
+
6
  import os
7
+ #db_url = os.environ.get("DATABASE_URL", "")
8
+
9
+ from sqlalchemy import URL
10
 
11
+ db_url = URL.create(
12
+ "mysql+mysqlclient",
13
+ username="ibmabdulsalam",
14
+ password="opengenai", # plain (unescaped) text
15
+ host="ibmabdulsalam.mysql.pythonanywhere-services.com",
16
+ database="default",
17
+ )
18
  #database = databases.Database(settings.db_url)
19
  SQLALCHEMY_DATABASE_URL = "ibmabdulsalam.mysql.pythonanywhere-services.com" #"sqlite:///./sql_app.db"
20
  #SQLALCHEMY_DATABASE_URL = db_url #"postgresql://user:password@postgresserver/db"