forked from learn-co-curriculum/python-p3-freebie-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.py
More file actions
31 lines (21 loc) · 950 Bytes
/
debug.py
File metadata and controls
31 lines (21 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
import sys
import os
# Get the absolute path to the directory containing this script (which is 'lib/')
current_script_dir = os.path.dirname(os.path.abspath(__file__))
# Get the absolute path to the project root (the parent directory of 'lib/')
project_root_dir = os.path.join(current_script_dir, '..')
# Add the project root to sys.path
sys.path.insert(0, project_root_dir)
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from lib.models import Base, Company, Dev, Freebie # <--- This line relies on the above fix!
if __name__ == '__main__':
engine = create_engine('sqlite:///freebies.db')
Base.metadata.create_all(engine)
Session = sessionmaker(bind=engine)
session = Session()
print("Ready for debugging!")
print("You have access to: session, Company, Dev, Freebie")
import ipdb; ipdb.set_trace() # Ensure this is AFTER session is defined
session.close()