为了分而治之,目录结构如下:
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 [email protected]:~/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合入到总部
[email protected]:~/c/mysite# cat mysite/urls.py urlpatterns = [ url(r‘^admin/‘, admin.site.urls), url(r‘^polls$‘,include(‘polls.urls‘)), ]
时间: 2024-10-20 03:34:45