Skip to content

Commit b947e18

Browse files
committed
Add cockroachdb config and module
1 parent 4c787e8 commit b947e18

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Diff for: backend/app.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from resources.user import UserAPI, UsersAPI, user_ns, users_ns
2424

2525

26-
2726
# Heroku-specific postgresql config
2827
# uri = os.getenv("DATABASE_URL")
2928
# if uri and uri.startswith("postgres://"):
@@ -61,7 +60,10 @@
6160
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + os.path.join(basedir, "db.sqlite")
6261
else:
6362
# Production DB
63+
from sqlalchemy import create_engine
6464
app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get("DATABASE_URL")
65+
engine = create_engine(os.environ['DATABASE_URL'])
66+
engine.connect()
6567
# Apply db settings
6668
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
6769
app.config["PROPAGATE_EXCEPTIONS"] = True

Diff for: backend/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pytz==2021.1
2828
regex==2021.4.4
2929
six==1.16.0
3030
SQLAlchemy==1.4.17
31+
sqlalchemy-cockroachdb==1.4.4
3132
toml==0.10.2
3233
typing==3.7.4.3
3334
Werkzeug==0.16.1

0 commit comments

Comments
 (0)