说这是我的网址:
url(r'^$', mainApp_views.homepage),
是否可以查看此文本=" mainApp_views.homepage"在视图和中间件?
提前致谢,
答案 0 :(得分:1)
你想要像
这样的东西pandas.plot
您可能还想在网址中添加名称from django.core.urlresolvers import resolve
def your_view(request):
# resolve the url from the path
url_name = resolve(request.path).url_name
答案 1 :(得分:0)
从Django 2.0开始,您需要从resolve
导入django.urls
:
from django.urls import resolve
def your_view(request):
url_name = resolve(request.path).url_name
print(url_name) #prints the "name" attribute in your urlpatterns