django项目报Page not found(404)The current URL, server/cgm_test1, didn't match any of these.

django项目报Page not found(404)The current URL, server/cgm_test1, didn't match any of these.

问题描述:

如题。在学python,感觉自己路径写的没有问题,但是死活匹配不到。请帮忙看看是不是正则写的有什么问题。

img

1、用的fastcgi,启动django命令用的python manage.py runfcgi host=127.0.0.1 port=8051 method=threaded,启动是正常的。能连到我的django,是不是可以说明至少fastcgi是OK的。
2、django的目录结构如下

img


1)项目名字叫cgm_test_django1
主目录下的urls内容:

from django.conf.urls import include, url
from django.contrib import admin
from flup.server.fcgi import WSGIServer

urlpatterns = [
    url(r'^cgm_test1/', include('cgm_test1.urls')),
]

2)app名字叫cgm_test
cgm_test目录下的urls内容是:


from django.shortcuts import render
from django.conf.urls import url
from flup.server.fcgi import WSGIServer
from views import index

urlpatterns = [
    url(r'^cgm_test1/',index),
]

3)views.py里面的内容是:


#-*-coding:utf-8-*-
from django.shortcuts import render

# Create your views here.
from django.http.response import HttpResponse
from django.http import request
from django.shortcuts import render, redirect, get_object_or_404
#from models import UserInfo
import json
from django.core import serializers
from django.contrib.sessions.backends.db import SessionStore
from django.contrib.sessions.models import Session
from django.contrib.auth.models import Permission,Group,User
from flup.server.fcgi import WSGIServer

from django.shortcuts import render
from django.http import HttpResponse


def index(request):
    return HttpResponse("Hello, world. You're at the polls index.")

根据你urls,你的链接应该是
http://localhost:8051/cgm_test1/cgm_test1/