Home  >  Q&A  >  body text

python - 使用eclipse运行django代码,修改了views.py这个文件,但是浏览器显示的还是原有没修改的结果,怎么处理?

使用eclipse运行django代码,修改了views.py这个文件,但是浏览器显示的还是原有没修改的结果,怎么处理?
我已经将views.py里面的代码:

from django.http import HttpResponse

def hello(request):
    return HttpResponse("<h1>Hello Django!</h1>")

修改为:

from django.http import HttpResponse

def hello(request):
    return HttpResponse("<h1>aaa!</h1>")

然后如下图这样运行:

但是浏览器显示的还是Hello Django!
而不是aaa,这是为什么?我已经清理了浏览器缓存了。

还有就是下图这2种runserver和runserver--noreload有什么区别?
我用runserver时控制台没有任何输出,但是用runserver--noreload时,控制台会输出一些文字。
这个有输出:

这个没有输出:

PHP中文网PHP中文网2741 days ago861

reply all(2)I'll reply

  • 黄舟

    黄舟2017-04-18 10:25:25

    Have you restarted the project after modifying the code

    reply
    0
  • 黄舟

    黄舟2017-04-18 10:25:25

    I followed your instructions, clicked on the red one, and then ran it, but it didn’t work!

    reply
    0
  • Cancelreply