Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 日食Django_Python_Django_Eclipse - Fatal编程技术网

Python 日食Django

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,如下所示
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')