Update database.py
Browse files- database.py +4 -2
database.py
CHANGED
@@ -1,11 +1,13 @@
|
|
1 |
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 |
|
6 |
#database = databases.Database(settings.db_url)
|
7 |
#SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app.db"
|
8 |
-
SQLALCHEMY_DATABASE_URL =
|
9 |
|
10 |
engine = create_engine(
|
11 |
SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
|
|
|
1 |
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 = "sqlite:///./sql_app.db"
|
10 |
+
SQLALCHEMY_DATABASE_URL = db_url #"postgresql://user:password@postgresserver/db"
|
11 |
|
12 |
engine = create_engine(
|
13 |
SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
|