djangosnippets.org: Latest snippets tagged with 'url pattern'http://djangosnippets.org/tags/url-pattern/2010-11-11T05:13:35.022587-06:00Automatic urls for static pages
2010-11-11T05:13:35.022587-06:00jibbolohttp://djangosnippets.org/snippets/2256/<p>Create in your template dir html files named example.static.html and with this snippet you can get the static page with the url /example/. If you put static file in a sub-directory, the url will be /sub-directory/example/</p>
<p><strong>Example:</strong></p>
<p><code>static_urls = StaticUrls()</code></p>
<p><code>urlpatterns = patterns('', *static_urls.discover())</code></p>
<p><code>urlpatterns += patterns('',</code></p>
<pre><code>`(r'^admin/doc/', include('django.contrib.admindocs.urls')),`
`(r'^admin/', …</code></pre>
Freely redistributable