Prepare for binary release
This commit is contained in:
@@ -35,7 +35,11 @@ def create_app(
|
|||||||
"""Create and configure the Flask application."""
|
"""Create and configure the Flask application."""
|
||||||
config = AppConfig.from_env(test_config)
|
config = AppConfig.from_env(test_config)
|
||||||
|
|
||||||
|
if getattr(sys, "frozen", False):
|
||||||
|
project_root = Path(sys._MEIPASS)
|
||||||
|
else:
|
||||||
project_root = Path(__file__).resolve().parent.parent
|
project_root = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
app = Flask(
|
app = Flask(
|
||||||
__name__,
|
__name__,
|
||||||
static_folder=str(project_root / "static"),
|
static_folder=str(project_root / "static"),
|
||||||
|
|||||||
@@ -4,12 +4,18 @@ from __future__ import annotations
|
|||||||
import os
|
import os
|
||||||
import secrets
|
import secrets
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
PROJECT_ROOT = Path(__file__).resolve().parent.parent
|
if getattr(sys, "frozen", False):
|
||||||
|
# Running in a PyInstaller bundle
|
||||||
|
PROJECT_ROOT = Path(sys._MEIPASS)
|
||||||
|
else:
|
||||||
|
# Running in a normal Python environment
|
||||||
|
PROJECT_ROOT = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
|
||||||
def _prepare_config_file(active_path: Path, legacy_path: Optional[Path] = None) -> Path:
|
def _prepare_config_file(active_path: Path, legacy_path: Optional[Path] = None) -> Path:
|
||||||
|
|||||||
Reference in New Issue
Block a user