我尝试在我的项目(称为注册)的settings.py中将ROOT_URLCONF
设置为各种字符串:ROOT_URLCONF = 'registration.urls'
,ROOT_URLCONF = 'foo.urls'
,ROOT_URLCONF = 'monkey.urls'
,{{1} }。
无论如何,我在我的主页上得到了这个输出:
ROOT_URLCONF = 'registration.registration.urls'
为什么?这是我用来配置Passenger(passenger_wsgi.py)的文件。该文件位于“/ home / david / registration / registration /."
Page not found (404)
Request Method: GET
Request URL: http://78.198.124.245/
Directory indexes are not allowed here.
You're seeing this error because you have DEBUG = True in your Django settings file.
/home/david/registration/registration/urls.py看起来像这样。
import os, sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "registration.settings")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
sys.path.append(os.getcwd())
sys.path.append("/home/david/registration/registration")
sys.path.append("/home/david/registration/registration/app")
为什么我的Django应用程序完全忽略我的ROOT_URLCONF设置并在每次访问主页时返回相同的输出?
答案 0 :(得分:0)
你的任何尝试都没有实际存在于python路径中。如果路径为/home/david/registration/registration
且网址位于/home/david/registration/registration/urls.py
,则从第一个到第二个的相对路径应该是什么?