问题描述
我们有微服务架构,每个 Django 项目都充当一个小型微服务。 每个 Django 项目都至少运行一个应用程序,我们正在努力使我们的 Django 项目可安装,以便我们可以在任何地方发布这些微服务。
我可以将我的 Django 服务设置为可安装,但是当我在 INSTALLED_APPS 中添加应用程序路径时,它不允许这样做。
project
目录包含 settings
、urls
等文件
安装文件看起来像
import setuptools
setuptools.setup(
name="project",# Replace with your own username
version="0.0.1",author="Example Author",author_email="author@example.com",description="A small example package",long_description="this is test",long_description_content_type="text/markdown",url="https://github.com/pypa/sampleproject",project_urls={"Bug Tracker": "https://github.com/pypa/sampleproject/issues",},classifiers=[
"Programming Language :: Python :: 3","License :: OSI Approved :: MIT License","Operating System :: OS Independent",],package_dir={"": "src"},packages=setuptools.find_packages(where="src"),python_requires=">=3.6",entry_points={
"mysite.plugin.1": [],"console_scripts": ["manage-framework=mysite.manage:main"],)
现在,当我安装它并尝试运行带有 manage-framework runserver
的服务器时,它会抛出以下错误。
django.core.exceptions.ImproperlyConfigured: Cannot import 'polls'. Check that 'mysite.polls.apps.PollsConfig.name' is correct.
我在 INSTALLED_APPS 中添加了 mysite.polls.apps.PollsConfig
注意:我遵循此处的包装结构Packaging
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)