django设置首页
1.在views中添加一个def 为homepage
basepath=os.getcwd()+'\\dockerApp\\app\\templates\\';
def homepage(request):
response=render_to_response(basepath+"index.html");
return response
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)
]
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)
]