Python 日食Django
我使用回调函数注册URL,如下所示Python 日食Django,python,django,eclipse,Python,Django,Eclipse,我使用回调函数注册URL,如下所示URL(r'^G2S/TestList$',TestList) 这是回调函数 def testList(request): fi = open('testlist.html', 'r') html = fi.read() fi.close(); #html = '<html><body> <FORM ACTION="/G2S/HostReceiver" METHOD="POST">
URL(r'^G2S/TestList$',TestList)
这是回调函数
def testList(request):
fi = open('testlist.html', 'r')
html = fi.read()
fi.close();
#html = '<html><body> <FORM ACTION="/G2S/HostReceiver" METHOD="POST"> First name: <INPUT TYPE="TEXT" NAME="firstName" VALUE="J. Random"><BR> Last name: <INPUT TYPE="TEXT" NAME="lastName" VALUE="Hacker"><P> <INPUT TYPE="SUBMIT"></FORM> </body></html>'
return HttpResponse(html)
为什么它只在eclipse中出错
还有一件事,为什么调试模式上的eclipse断点似乎不起作用
例如,我在上面的回调函数(testList)中检查一个断点,然后输入to
http://127.0.0.1:8000/G2S/TestList
在调试模式下,我认为eclipse应该在我检查的点停止,尽管出现了错误,但没有,为什么 了解如何在项目中使用模板。不建议使用这样的文件操作
将其添加到设置.py
文件中
TEMPLATE_DIRS = (
os.path.join(PROJECT_ROOT, '<app>/templates'))
TEMPLATE_DIRS = (
os.path.join(PROJECT_ROOT, '<app>/templates'))
return render(request, 'testlist.html')