【发布时间】:2020-04-17 15:47:45
【问题描述】:
[这是我要在浏览器屏幕中投影的文本文件。
第二个是具有该功能的视图文件。 path('ShowFile', views.ShowFile, name ='ShowFile') in the last picture in the urls.py
【问题讨论】:
[这是我要在浏览器屏幕中投影的文本文件。
第二个是具有该功能的视图文件。 path('ShowFile', views.ShowFile, name ='ShowFile') in the last picture in the urls.py
【问题讨论】:
您可以使用这样的函数,根据需要替换路径。
def ShowFile(request):
f = open("C:\\Users\\Soumyaranjan\\PycharmProjects\\Textutils\\textutils\\textutils\\one.txt", "r")
content = f.readlines()
return HttpResponse(content)
【讨论】: