Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- تغییر WORKDIR به /app/peikarband تا Reflex بتواند rxconfig.py را پیدا کند - اضافه کردن کد در peikarband/__init__.py برای ثبت peikarband.peikarband در sys.modules - این کد peikarband.peikarband را به صورت خودکار load میکند وقتی peikarband package import میشود - تست کامل انجام شده
40 lines
1.8 KiB
Python
40 lines
1.8 KiB
Python
"""Peikarband Landing Application Package.
|
|
|
|
This package exports the Reflex app instance.
|
|
The peikarband.peikarband submodule is provided by peikarband/peikarband/__init__.py
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
|
|
# Register peikarband.peikarband submodule in sys.modules
|
|
# This is necessary when running from /app/peikarband directory
|
|
# so Python can find peikarband.peikarband even when working directory is inside the package
|
|
# Use realpath to resolve any . or .. in the path
|
|
# When __file__ is peikarband/peikarband/__init__.py (because we're inside the package),
|
|
# we need to go up one level to get to peikarband/ directory
|
|
_peikarband_dir = os.path.dirname(os.path.realpath(__file__))
|
|
# Check if we're in a nested peikarband/peikarband/ structure
|
|
_parent_dir = os.path.dirname(_peikarband_dir)
|
|
if os.path.basename(_peikarband_dir) == 'peikarband' and os.path.basename(_parent_dir) == 'peikarband':
|
|
# We're in peikarband/peikarband/__init__.py, go up to peikarband/
|
|
_peikarband_dir = _parent_dir
|
|
_peikarband_submodule_path = os.path.join(_peikarband_dir, 'peikarband', '__init__.py')
|
|
if os.path.exists(_peikarband_submodule_path):
|
|
try:
|
|
import importlib.util
|
|
_spec = importlib.util.spec_from_file_location("peikarband.peikarband", _peikarband_submodule_path)
|
|
_peikarband_module = importlib.util.module_from_spec(_spec)
|
|
# Register in sys.modules BEFORE exec_module so it can be found during import
|
|
sys.modules["peikarband.peikarband"] = _peikarband_module
|
|
_spec.loader.exec_module(_peikarband_module)
|
|
except Exception as e:
|
|
# If loading fails, remove from sys.modules to avoid partial state
|
|
if "peikarband.peikarband" in sys.modules:
|
|
del sys.modules["peikarband.peikarband"]
|
|
# Re-raise to see the error
|
|
raise
|
|
|
|
__all__ = []
|
|
|