嗨,我有一个令人毛骨悚然的问题。
我有这样的网址格式:
# mproject/myapp.urls.py
url(r'^project/(?P<project_id>\d+)/$','user_profile.views.EditProject',name='edit_project'),
它在浏览器中可以正常工作,但是当我在外壳中执行此操作时,可以进行测试:
from django.test import Client
from django.core.urlresolvers import reverse
client= Client()
response = client.get(reverse('edit_project'), project_id=4)
我感到恐惧:
NoReverseMatch: Reverse for 'edit_project' with arguments '()' and keyword arguments '{}' not found.
我在这里想念什么?
from django.urls import reverse