Django的网址正则表达式引擎失败 [英] Django's URL regex engine is failing

查看:208
本文介绍了Django的网址正则表达式引擎失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Django的网址正则表达式引擎失败,我不知道为什么。即使我的理智检查也是可怕的。



这是我的 urls.py

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

urlpatterns = patterns('',
url(r'^ a','placemyorder。 views.home',name ='home'),

我得到这个404错误:

 找不到页面(404)
请求方法:GET
请求URL:http: / [ip address] / a /
使用placemyorder.urls中定义的URLconf,Django按照以下顺序尝试了这些URL模式:
1. ^ a [name ='home']
当前的网址与其中的任何一个都不匹配。

当我访问



http:// [ip address] / a



它是托管在Django 1.5.2与Python 2.7.3在Ubuntu

解决方案

这是一个线索:当前的URL,didn不要匹配任何这些。



应该说:当前的URL http:// [ip address ] / a,没有匹配任何这些。



所以调度员没有获取请求url。



查看此解决方案:

Django + NGINX URL问题


Django's URL regex engine is failing and I have no idea why. Even my sanity checks are failing horribly.

Here's my urls.py:

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

urlpatterns = patterns('',
    url(r'^a', 'placemyorder.views.home', name='home'),
)

I get this 404 error:

Page not found (404)
Request Method: GET
Request URL:    http://[ip address]/a/
Using the URLconf defined in placemyorder.urls, Django tried these URL patterns, in this order:
1. ^a [name='home']
The current URL, , didn't match any of these.

when I visit

http://[ip address]/a

And it's hosted on Django 1.5.2 with Python 2.7.3 on Ubuntu 12.04 behind nginx if that info is relevant.

解决方案

Here's a clue: The current URL, , didn't match any of these.

It should say: The current URL, http://[ip address]/a, didn't match any of these.

So the dispatcher isn't getting the request url.

Take a look at this solution:
Django + NGINX URL Problem

这篇关于Django的网址正则表达式引擎失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆