Skip to content
This repository was archived by the owner on Nov 26, 2020. It is now read-only.

Commit 96a98ed

Browse files
author
Christopher Peplin
committed
Use a database on disk when not in debug mode.
1 parent 64e5219 commit 96a98ed

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ MANIFEST
77
*.egg*
88
.coverage
99
htmlcov
10+
db*

astral/conf/global_settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@
3636

3737
if DEBUG:
3838
ASTRAL_WEBSERVER = "http://localhost:4567"
39+
DATABASE_PATH = ":memory:"
3940
else:
4041
ASTRAL_WEBSERVER = "http://astral-video.heroku.com"
42+
DATABASE_PATH = "db"
4143

4244
BOOTSTRAP_NODES = [
4345
]

astral/models/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
from sqlalchemy import create_engine
33
from sqlalchemy.pool import StaticPool
44

5+
from astral.conf import settings
56
from astral.models.node import Node
67
from astral.models.stream import Stream
78
from astral.models.ticket import Ticket
89
from astral.models.event import Event
910

10-
11-
metadata.bind = create_engine("sqlite:///:memory:?check_same_thread=False",
12-
echo=False, poolclass=StaticPool)
11+
metadata.bind = create_engine("sqlite:///%s?check_same_thread=False" %
12+
settings.DATABASE_PATH, echo=False, poolclass=StaticPool)
1313

1414
setup_all()
1515
create_all()

0 commit comments

Comments
 (0)