我的Apache2虚拟主机配置中有这个WSGIScriptAlias / django / / path / to / app。
我使用django-admin startproject myapp创建了项目。 但是当我转到http://localhost/django/时,通过Django收到404错误 如果我将virtualhost配置更改为/,然后重新启动apache2。它有效,但我将其用于其他用途,因此是virtualhost和/ django /子路径的原因。但是看来Django的工作方式不正确。
Page not found (404)
Request Method: GET
Request URL: http://localhost/django/
Using the URLconf defined in djangoexamplecom.urls, Django tried
these URL patterns, in this order:
^admin/
The empty path didn't match any of these.
You're seeing this error because you have DEBUG = True in your
Django settings file. Change that to False, and Django will
display a standard 404 page.
我猜测当运行django-admin startproject时,它希望应用程序以默认URL运行,即http://localhost/没有子路径?
我是否需要编辑url.py或settings.py才能使用/ django /?