[FIX] ایجاد ساختار peikarband/peikarband/ برای حل مشکل ModuleNotFoundError (fix) | ApprovalToken: accepted
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

- ایجاد subdirectory peikarband/peikarband/ با __init__.py
- این ساختار طبیعی Python است که Reflex می‌تواند peikarband.peikarband را پیدا کند
- ساده‌سازی peikarband/__init__.py با حذف کدهای پیچیده sys.modules
- این راه حل پایدارتر و قابل اعتمادتر از روش قبلی است
This commit is contained in:
Ehsan.Asadi
2025-12-31 04:17:00 +03:30
parent 066ce4a5c1
commit 00cd8aed90
2 changed files with 14 additions and 20 deletions

View File

@@ -1,26 +1,9 @@
"""Peikarband Landing Application Package. """Peikarband Landing Application Package.
This package exports the Reflex app instance. This package exports the Reflex app instance.
Reflex expects to find 'app' in peikarband.peikarband when app_name='peikarband'. The peikarband.peikarband submodule is provided by peikarband/peikarband/__init__.py
We create a peikarband submodule to satisfy this requirement.
""" """
# Import app from app.py module (same package) # Empty init - the app is exported from peikarband.peikarband submodule
from .app import app __all__ = []
# Create peikarband submodule to satisfy Reflex's peikarband.peikarband lookup
import sys
from types import ModuleType
# Create a peikarband submodule that contains the app
# This allows Reflex to find peikarband.peikarband.app
_peikarband_module = ModuleType('peikarband.peikarband')
_peikarband_module.app = app
_peikarband_module.__all__ = ['app']
sys.modules['peikarband.peikarband'] = _peikarband_module
# Also make peikarband attribute available for direct access
peikarband = _peikarband_module
__all__ = ["app", "peikarband"]

View File

@@ -0,0 +1,11 @@
"""Peikarband submodule for Reflex compatibility.
Reflex expects to find 'app' in peikarband.peikarband when app_name='peikarband'.
This submodule provides that structure.
"""
# Import app from parent package's app.py
from ..app import app
__all__ = ["app"]