1.在views中添加一个def 为homepage
basepath=os.getcwd()+‘\\dockerApp\\app\\templates\\‘;
def homepage(request):
response=render_to_response(basepath+"index.html");
return response
2.在urls.py中添加红色部分
from django.conf.urls import include, url
from django.contrib import admin
from app.views import *;
admin.autodiscover()
urlpatterns = [
url(r‘^admin/‘, include(admin.site.urls)),
url(r‘^$‘,homepage),
url(r‘^getdata/$‘,getdata)
]
时间: 2024-10-16 20:45:01