django设置首页

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)
]
 
posted @ 2015-01-19 11:25  BiboXie  阅读(8549)  评论(1编辑  收藏  举报