【django】另一种思路代替nginx 的rewrite

需求:访问xx.com 跳转到xx.com/index

修改setting 同级别的urls.py 文件

from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from testTask import views
from django.views.static import serve

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^at/', include('testTask.urls')),
    url(r'^static/(?P<path>.*)$', serve, {'document_root':'/Users/conan/vir_env/AutoTest/static/'}),
    url(r'^',views.index), #域名直接跳转到首页
]

 

posted @ 2019-10-14 18:58  东方不败--Never  阅读(294)  评论(0编辑  收藏  举报