Use relative paths from project root instead of app.root_path for better portability

parent e3fad9df
......@@ -34,12 +34,16 @@ from .api import api_bp
from .admin import admin_bp
from .utils import get_current_user_session, login_required, admin_required
app = Flask(__name__, template_folder='../templates', static_folder='../static')
# Determine project root (parent of vidai directory)
project_root = os.path.dirname(app.root_path)
app = Flask(__name__,
template_folder=os.path.join(project_root, 'templates'),
static_folder=os.path.join(project_root, 'static'))
app.secret_key = os.environ.get('FLASK_SECRET_KEY', 'dev-secret-key-change-in-production')
os.makedirs('../static', exist_ok=True)
# Ensure avatars directory exists
avatars_dir = os.path.join(app.root_path, '..', 'static', 'avatars')
avatars_dir = os.path.join(project_root, 'static', 'avatars')
os.makedirs(avatars_dir, exist_ok=True)
# Global configuration
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment