Django templates folders

后端 未结 4 501
遥遥无期
遥遥无期 2020-12-02 13:39

I\'m experimenting with Django, and figuring out how to set urls.py, and how the URLs work. I\'ve configured urls.py in the root of the pro

4条回答
  •  执念已碎
    2020-12-02 14:17

    I think it depends what you want your home page to be. If its simply a page with links off to other parts of your site then catherine's answer is a nice clean way.

    If you want the root of your site to be your blog for example I would do this:

    urlpatterns = patterns('',
        # Django Admin
        url(r'^admin/', include(admin.site.urls)),
        # Tiny MCE Urls
        url(r'^tinymce/', include('tinymce.urls')),
        # Other App
        url(r'^other/', include('projectname.other.urls', namespace='other')),
        # Blog App
        url(r'^', include('projectname.blog.urls', namespace='blog')),
    )
    

    Also don't forget to name space your url includes: https://docs.djangoproject.com/en/dev/topics/http/urls/#url-namespaces

提交回复
热议问题