为了分而治之,目录结构如下:
1,
mysite/ ├── db.sqlite3 ├── manage.py ├── mysite │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── polls │ ├── admin.py │ ├── models.py │ ├── urls.py │ └── views.py └── templates └── admin └── base_site.html
polls/urls.py root@lanny:~/c/mysite# cat polls/urls.py from django.conf.urls import url from polls import views urlpatterns = [ url(r‘^$‘,views.index,name=‘index‘), ]
polls下的url合入到总部
root@lanny:~/c/mysite# cat mysite/urls.py urlpatterns = [ url(r‘^admin/‘, admin.site.urls), url(r‘^polls$‘,include(‘polls.urls‘)), ]
本文出自 “LannyMa” 博客,请务必保留此出处http://lannyma.blog.51cto.com/4544390/1738404
原文地址:http://lannyma.blog.51cto.com/4544390/1738404