【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), #域名直接跳转到首页
]

 

上一篇:nginx重定向rewrite


下一篇:Nginx-Location匹配与Rewrite重写跳转