English 中文(简体)
为什么Django无视我的RoOT_URLCONF环境?
原标题:Why is Django ignoring my ROOT_URLCONF setting?
  • 时间:2012-05-18 03:03:30
  •  标签:
  • django

我尝试在环境中设置<代码>ROOT_URLCONF。 py in my project ( known Registration) to a range of strings: ROOT_URLCONF = 登记:urls ,ROOT_URLCONF = foo.urls ,ROOT_URLCONF = mon.urls ,ROOT_URLCONF = 登记。

不管怎样,我还是把这一产出放在我的主页上:

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.

Why is that? Here is the file I am using to configure Passenger (passenger_wsgi.py). This file is located in "/home/david/registration/registration/."

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")

/home/david/ Registration/urls.py就是如此。

from django.conf.urls import patterns, include, url, http

def myFunction(request):
    return http.HttpResponse("A mapped URL")

urlpatterns = patterns(  ,
    (r ^$ ,  myFunction )
)

为什么我的Django申请完全无视我的ROOT_URLCONF,每当我进入我的主页时,就确定并归还同样的产出?

问题回答

你们的遗体实际上都没有在平线上居住。 如果路径为<代码>/home/david/ Registration/code,则长度为/home/david/ Registration/urls.py。 那么,从一到二的相对途径是什么?





相关问题
How to get two random records with Django

How do I get two distinct random records using Django? I ve seen questions about how to get one but I need to get two random records and they must differ.

Moving (very old) Zope/Plone Site to Django

I am ask to move data from a (now offline) site driven by Plone to a new Django site. These are the version informations I have: Zope Version (unreleased version, python 2.1.3 ) Python Version 2.1....

Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

Flexible pagination in Django

I d like to implement pagination such that I can allow the user to choose the number of records per page such as 10, 25, 50 etc. How should I go about this? Is there an app I can add onto my project ...

is it convenient to urlencode all next parameters? - django

While writing code, it is pretty common to request a page with an appended "next" query string argument. For instance, in the following template code next points back to the page the user is on: &...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

热门标签