from django.conf.urls import patterns, include, url
urlpatterns = [
url(r'^all/$','article.views.articles'),
url(r'^get/(?P<article_id>)\d+/','article.views.article'),
]
这是我的urls.py和,我与基地10获得了无效文字的ValueError异常的INT():“”
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.template.loader import get_template
from django.template import Context
from django.views.generic.base import TemplateView
from article.models import Article
def articles(request):
return render_to_response('articles.html',{'articles':Article.objects.all()})
def article(request, article_id=1):
return render_to_response('article.html', {'article':Article.objects.get(id=article_id)})
以上就是我views.py但是当我尝试运行mysite/get/1 /它给我错误的无效文字为int()与基10:''。我试图通过引用其他问题来解决它,但它仍然不起作用。
您可以包括回溯? –