Spaces:
Sleeping
Sleeping
Commit
·
275b1e7
1
Parent(s):
ac008cf
Refactor app initialization and migration script: make __init__.py intentionally empty for package structure, and update migrate.py to include project root in Python path for improved module accessibility.
Browse files- app/__init__.py +2 -2
- scripts/migrate.py +6 -0
app/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
"""App package initialization."""
|
2 |
-
from app.models import Base
|
3 |
|
4 |
-
|
|
|
|
1 |
"""App package initialization."""
|
|
|
2 |
|
3 |
+
# This file intentionally left empty to make the directory a Python package.
|
4 |
+
# We'll import models where they're needed rather than at the package level.
|
scripts/migrate.py
CHANGED
@@ -1,8 +1,14 @@
|
|
1 |
"""Database migration script."""
|
2 |
import os
|
|
|
3 |
import logging
|
4 |
from alembic.config import Config
|
5 |
from alembic import command
|
|
|
|
|
|
|
|
|
|
|
6 |
from app.models.database import Base
|
7 |
|
8 |
# Configure logging
|
|
|
1 |
"""Database migration script."""
|
2 |
import os
|
3 |
+
import sys
|
4 |
import logging
|
5 |
from alembic.config import Config
|
6 |
from alembic import command
|
7 |
+
|
8 |
+
# Add the project root to the Python path
|
9 |
+
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
10 |
+
sys.path.insert(0, project_root)
|
11 |
+
|
12 |
from app.models.database import Base
|
13 |
|
14 |
# Configure logging
|