python - 如何在子包中运行 django
问题描述
我的项目结果如下,django在automl/service,在automl/service/worker/suggester.py文件中有一个import from automl.core import util
,这个文件是views.py导入的,运行python service/manage.py runserver
的时候会抛出异常
from automl.core import util
ModuleNotFoundError: No module named 'automl'
如何解决这个问题,django不能在子包中运行吗?
├── automl
│ ├── __init__.py
│ ├── core
│ │ ├── __init__.py
│ │ └── base.py
│ ├── example
│ │ ├── __init__.py
│ │ └── demo.py
│ └── service
│ ├── __init__.py
│ ├── manage.py
│ ├── master
│ │ ├── __init__.py
│ │ └── urls.py
│ ├── settings.py
│ ├── worker
│ │ ├── __init__.py
│ │ ├── admin.py
│ │ ├── apps.py
│ │ ├── exceptions.py
│ │ ├── models.py
│ │ ├── suggester.py
│ │ ├── tests.py
│ │ ├── urls.py
│ │ └── views.py
│ ├── urls.py
│ └── wsgi.py
├── bin
├── build.sh
├── ci.yml
├── conf
│ └── log_config.json
└── docs
解决方案
推荐阅读
- azure - 升级 QnAMaker Azure 搜索服务
- node.js - 如何通过传递条件的 JSON 对象使用 Vogels 扫描或查询 Dynamodb 表?
- python - NameError:名称“ReleaseDeal”未在 Django 中定义
- php - 解析错误:第 28 行 C:\xampp\htdocs\php\order\instagramapi.php 中的语法错误、意外的 ':'、期待 ',' 或 ')'
- cplex - 在 OPL 的后处理执行命令中创建元组
- c++ - 在 C++ 中打开一个 ifstream 文件
- javascript - 在 Pyppeteer 中,设置超时时间并非在所有情况下都有效
- javascript - 如何在对象的字符串中调用函数?
- javascript - 如何即时发送 UTC 格式的长值?
- php - 存储 100 万行的最佳和最安全的方法