1、在站点blog下单独创建urls.py文件
# -*- coding: UTF-8 -*- from django.conf.urls import patterns, include, url urlpatterns = patterns(‘blog.views‘, url(r‘^index/$‘, ‘index‘), url(r‘^time/$‘, ‘time‘),
url(r‘^shengfen/$‘, ‘shengfen‘),
)
2、修改项目的urls.PY文件(非站点哦)
# -*- coding: UTF-8 -*- from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns(‘blog.views‘, # Uncomment the admin/doc line below to enable admin documentation: url(r‘^admin/doc/‘, include(‘django.contrib.admindocs.urls‘)), # Uncomment the next line to enable the admin: url(r‘^admin/‘, include(admin.site.urls)), #url(r‘^$‘, ‘blog.views.index‘), url(r‘^blog/‘, include("blog.urls")),#浏览器一旦访问blog就定位到blog.urls文件下的url地址 )
3、百度网盘:django之创建第7-3个项目-在站点blog下单独创建urls.py文件
时间: 2024-10-25 22:54:06