[FIX] ایجاد ساختار peikarband/peikarband/ برای حل مشکل ModuleNotFoundError (fix) | ApprovalToken: accepted
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
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:
@@ -1,26 +1,9 @@
|
||||
"""Peikarband Landing Application Package.
|
||||
|
||||
This package exports the Reflex app instance.
|
||||
Reflex expects to find 'app' in peikarband.peikarband when app_name='peikarband'.
|
||||
We create a peikarband submodule to satisfy this requirement.
|
||||
The peikarband.peikarband submodule is provided by peikarband/peikarband/__init__.py
|
||||
"""
|
||||
|
||||
# Import app from app.py module (same package)
|
||||
from .app import app
|
||||
|
||||
# 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"]
|
||||
# Empty init - the app is exported from peikarband.peikarband submodule
|
||||
__all__ = []
|
||||
|
||||
|
||||
11
peikarband/peikarband/__init__.py
Normal file
11
peikarband/peikarband/__init__.py
Normal 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"]
|
||||
|
||||
Reference in New Issue
Block a user