django-docs 的另一个模块未找到错误
Another module not found error for django-docs
我正在 运行安装 Cookiecutter django 应用程序。现在我想集成 django-docs (https://pypi.org/project/django-docs/)。我相当确定我做的是正确的,因为我只是从文档中复制和粘贴。安装后,我重新构建我的 docker 图像和 运行 我的服务器。
我收到错误:
ModuleNotFoundError: No module named 'docs.urls'
我的过程是这样的:
1) 将应用程序添加到基本要求
django-docs==0.3.1 # https://github.com/littlepea/django-docs
2) 将其添加到我的配置文件中的应用程序
...
'allauth.socialaccount',
'rest_framework',
'docs',
....
3) 重建 docker 图像
docker-compose -f local.yml build
4) 然后我将其添加到我的网址中,这会引发错误:
url(r'^docs/', include('docs.urls')),
我也试过了path('docs/', include('docs.urls')),
有什么我遗漏的吗?其他 SO 问题没有解决我的问题。
感谢您的帮助!非常感谢!
编辑:
我也做了:
DOCS_ROOT = os.path.join(BASE_DIR, '../doc/_build/html')
DOCS_ACCESS = 'staff'
检查django-docs
库是否正确安装,是否可以导入docs
模块:
$ docker-compose -f local.yml run --rm django python manage.py shell
...
>>> import docs
如果出现错误,它可能会提示您哪里出了问题。如果可以导入,请检查它实际上是 django-docs
库而不是一些冲突模块:
>>> docs.__file__
我正在 运行安装 Cookiecutter django 应用程序。现在我想集成 django-docs (https://pypi.org/project/django-docs/)。我相当确定我做的是正确的,因为我只是从文档中复制和粘贴。安装后,我重新构建我的 docker 图像和 运行 我的服务器。
我收到错误:
ModuleNotFoundError: No module named 'docs.urls'
我的过程是这样的:
1) 将应用程序添加到基本要求
django-docs==0.3.1 # https://github.com/littlepea/django-docs
2) 将其添加到我的配置文件中的应用程序
...
'allauth.socialaccount',
'rest_framework',
'docs',
....
3) 重建 docker 图像
docker-compose -f local.yml build
4) 然后我将其添加到我的网址中,这会引发错误:
url(r'^docs/', include('docs.urls')),
我也试过了path('docs/', include('docs.urls')),
有什么我遗漏的吗?其他 SO 问题没有解决我的问题。
感谢您的帮助!非常感谢!
编辑:
我也做了:
DOCS_ROOT = os.path.join(BASE_DIR, '../doc/_build/html')
DOCS_ACCESS = 'staff'
检查django-docs
库是否正确安装,是否可以导入docs
模块:
$ docker-compose -f local.yml run --rm django python manage.py shell
...
>>> import docs
如果出现错误,它可能会提示您哪里出了问题。如果可以导入,请检查它实际上是 django-docs
库而不是一些冲突模块:
>>> docs.__file__