def year_archive(requsst,year):
if str(year) != "2025":
y = str(year) + ".html"
filepath = os.path.join(settings.BASE_DIR,"helloworld","temp",y)
with open(filepath) as f:
content = f.read()
return HttpResponse(content)
else:
return HttpResponse("這是未來")
也可以在函數(shù)內(nèi)避免路由沖突[開心]
承擔(dān)因您的行為而導(dǎo)致的法律責(zé)任,
本站有權(quán)保留或刪除有爭議評(píng)論。
參與本評(píng)論即表明您已經(jīng)閱讀并接受
上述條款。