Python Django从后端打开html页面

Python Django从后端打开html页面,python,html,django,Python,Html,Django,如果使用django在后端触发事件,如何显示html页面 方向.py # render error html if list is empty if len(waypoint) == 0: print("Trip not possible with selected specs : Not enough charging stations") #open error.html page views.py def error(request):

如果使用django在后端触发事件,如何显示html页面

方向.py

    # render error html if list is empty
    if len(waypoint) == 0:
    print("Trip not possible with selected specs : Not enough charging stations")
    #open error.html page
views.py

    def error(request):
       return render(request, 'routing/error.html')
url.py

    urlpatterns = [
       url(r'^error/$', views.error),
    ]

创建一个视图,该视图根据direction.py的结果呈现html模板。您在这里做什么还不清楚。什么是direction.py?如何调用它的函数?direction.py正在运行,没有问题,我只想从那里调用error函数,如果航路点列表是emtpy,则显示error.html站点