我遇到了Django urls的奇怪行为。尽管预测/上传url是在urls.py中定义的,Django说
找不到页面(404)
Request Method: POST
Request URL: http://localhost:8000/forecast/upload/
Using the URLconf defined in myproject.urls, Django tried these URL patterns, in this order:
polls/
admin/
forecast/ [name='index']
forecast/ **f
我通过cmd为Django.However设置了网页,在访问127.0.0.1:8001的索引页面时遇到了问题。我尝试更新urls.py,但仍然有问题。
浏览器页面错误:找不到页面(404)请求方法:获取请求URL:使用barry.urls中定义的URLconf,Django按以下顺序尝试了这些URL模式:
admin/当前路径index与这些都不匹配。
urls.py file:
"""{{ project_name }} URL Configuration
The `urlpatterns` list routes URLs to views. For more
我的urls.py是
from django.conf.urls import patterns,url
from rango import views
urlpatterns=patterns('',url(r'^$',views.index,name='index'))
urlpatterns=patterns('',url(r'^about/$',views.about,name='about'))
我的views.py是
from django.shortcuts import r
我的最小项目已经顺利地工作了几天,但是刚才突然抛出了page not found错误。
我双倍地检查了urls,但是找不到错误。
请求是http://127.0.0.1:8001/user/login/
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8001/user/login/
Using the URLconf defined in forum.urls, Django tried these URL patterns, in this order:
^admin/
^$ [name=
嗨,我是Python和Django的新手,我遵循指南。我刚刚安装了Python3.5和Django 1.9并收到了很多错误消息..。刚才我发现了很多垃圾,但现在都被困住了。我想添加视图,因此我在urls.py中添加了以下代码:
from django.conf.urls import include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
# Uncomment the
我不明白为什么Django无法在我的应用程序中找到请求的URL。
下面是我得到的错误代码:
Using the URLconf defined in littlelogsms.urls, Django tried these URL patterns, in this order:
^admin/
^$
The current URL, success/, didn't match any of these.
下面是我的sms.urls.py文件:
from django.conf.urls import url
from sms import views
urlpatterns
我使用以下命令添加了第二个应用程序:
python manage.py startapp about
在我的项目中。然而,现在它正在渲染我的第一个应用程序的唯一视图,无论我放在什么URL上。
例如。
这是我的settings.py:
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.9.
For more information on this file, see
https://docs.djangoproj
我做了一个名为trydjango的项目,在这里我可以访问我用products/<int:my_id> [name='product']链接创建的产品,但不知怎么的,它不起作用,我找不到错误。打开http://127.0.0.1:8000/products/1/时,会得到一个404页未找到的错误,如下所示
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/products/1/
Using the URLconf defined in trydjango.url
每次我运行django项目时,我都会得到这个错误NoReverseMatch at / Reverse for 'product_list_by_category' with keyword arguments '{'slug': 'legume'}'。我想列出我的产品,老实说,我甚至不知道问题出在哪里。
完全跟踪: django.urls.exceptions.NoReverseMatch:用关键字参数“{‘s’:'legume'}‘找不到'product_list_by_category’。1模式尝试:
我为Django应用程序创建了以下结构:
../programs/ #home page for the app
../program/id #detailed page about a specific program stored in the db
但是,当我尝试从browser ../programs/1访问(其中1是我想要查看的详细信息的程序的id )时,我得到以下错误:
ValueError at /programs/1/
invalid literal for int() with base 10: '1/'
Request Method: GET
Reque