【发布时间】:2020-08-30 05:29:34
【问题描述】:
我创建了一个Dash 应用程序,它自己运行良好(没有导入问题)。其他用户也创建了应用程序,我们现在希望将其合并到单个应用程序中,并使用链接每个应用程序的通用索引。我找不到加载我创建的包的解决方案。我想自己运行应用程序(调试目的)并通过通用索引(生产目的)。
这是我的应用程序的结构(类似于here on the Dash documentation 的详细结构):
+ app.py --> creates the dash server
+ layout.py --> Defines my page layout
+ callbacks.py --> I imported packages here (import package as pk) that will fail when run via the general index
+ package --> the packages I created
合并项目后,我的结构如下所示(通过git submodule add):
+ app.py
+ index.py --> will call the layouts
+ initial app folder (git submodule from structure above)
+ __init__.py
+ the files above
当我启动服务器时,我收到错误消息pk.something error, pk is not defined。我找不到让应用程序在通用索引中独立运行的解决方案。我试图移动导入(在app.py 或新的__init__.py 中)但没有任何效果。
我的下一个尝试是将包移动到一个新的子文件夹中。有谁知道这是否可行?
【问题讨论】:
标签: python python-import plotly-dash