#如www.sohu.com/jhys www.sohu.com/mystore #定义为/site url_prefix = '' if settings.CONTEXT_PATH: url_prefix = (settings.CONTEXT_PATH)[1:]+'/' def redirect(request): src = request.path target = src[len(url_prefix):] return HttpResponseRedirect(target) urlpatterns = patterns('', (r'^%s'%url_prefix,redirect), #下面的按照 (r'^$',index),