Exemple #1
0
admin.autodiscover()

handler404 = "apetizer.views.front.handler404"
handler500 = "apetizer.views.front.handler500"

urlpatterns = patterns(
    "",
    url(
        r"^sitemap\.xml$",
        sitemap,
        {"sitemaps": {"content": ContentSitemap()}},
        name="django.contrib.sitemaps.views.sitemap",
    ),
    # homepage
    url(r"^$", FrontView.as_view(), name="home", kwargs={"action": FrontView.default_action}),
    url(FrontView.get_url_regexp("^") + "\/$", FrontView.as_view(), kwargs={"path": "/"}),
    url(FrontView.get_url_regexp("(?P<path>.+)\/"), FrontView.as_view(), name=FrontView.view_name),
    url("^(?P<path>.+)\/$", FrontView.as_view(), name="home", kwargs={"action": FrontView.default_action}),
)

# This is only needed when using runserver.
if settings.DEBUG or True:
    urlpatterns = (
        patterns(
            "",
            url(
                r"^media/(?P<path>.*)$",
                "django.views.static.serve",  # NOQA
                {"document_root": settings.MEDIA_ROOT, "show_indexes": True},
            ),
Exemple #2
0
'''
Created on 15 janv. 2013

@author: rux
'''
from django.conf.urls import patterns, url
from apetizer.views.directory import DirectoryView
from apetizer.views.front import FrontView

handler404 = 'apetizer.views.front.handler404'
handler500 = 'apetizer.views.front.handler500'

urlpatterns = patterns( '', 
        # homepage
        url(r'^$',
            FrontView.as_view(),
            name='home',
            kwargs={'action':FrontView.default_action}),
        
        url(FrontView.get_url_regexp(r'^')+'\/$',
            FrontView.as_view(),
            kwargs={'path':'/'}),
        
        url(FrontView.get_url_regexp(r'^(?P<path>.+)\/'),
            FrontView.as_view(),
            name=FrontView.view_name,),
        
        url(r'^(?P<path>.+)\/$',
            FrontView.as_view(),
            name='home',
            kwargs={'action':FrontView.default_action}),