如何在子包中运行Django

2024-04-29 11:35:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我的项目结果如下:automl/service中的django,automl/service/worker中的django/建议者.py文件有一个导入from automl.core import util,此文件由导入视图.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

Tags: 文件项目djangofrompycoreimportmanage