Show
Ignore:
Timestamp:
12/04/07 08:06:16 (12 months ago)
Author:
JensDiemer
Message:

New settings ('SERVE_STATIC_FILES' and 'REDIRECT_OLD_PYLUCID_URL') for set up the urls.py

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid/PyLucid/urls.py

    r1300 r1320  
    2121handler404 = 'django.views.defaults.page_not_found' 
    2222handler500 = 'django.views.defaults.server_error' 
     23 
     24#______________________________________________________________________________ 
     25# The install section: 
    2326 
    2427# We insert the _install URLs only, if the _install section is activated. 
     
    5255    # _install section is deactivated -> start with a empty urls 
    5356    urls = () 
     57 
    5458 
    5559#______________________________________________________________________________ 
     
    9094    (r'^([\w/-]*?)/?$', 'PyLucid.index.index'), 
    9195 
    92     #_____________________________________ 
    93     # REDIRECT 
    94     # Redirect old PyLucid (with "index.py") to the new URLs. 
    95     # Only usefull, if you have a old PyLucid page used. 
    96     #(r'^index.py(.*?)$', 'PyLucid.index.redirect'), 
    97  
    98     #_____________________________________ 
    99     # STATIC FILES 
    100     # Using this method is inefficient and insecure. 
    101     # Do not use this in a production setting. Use this only for development. 
    102     # http://www.djangoproject.com/documentation/static_files/ 
    103     # 
    104     # uncomment the lines, if you use the dajngo development server: 
    105     #-------------------------------------------------------------------------- 
    106 #    ( 
    107 #        '^%s(?P<path>.*)$' % settings.MEDIA_URL.lstrip("/"), 
    108 #        'django.views.static.serve', 
    109 #        {'document_root': './%s' % settings.MEDIA_URL} 
    110 #    ), 
    11196    #-------------------------------------------------------------------------- 
    11297) 
     98 
     99 
     100if getattr(settings, "REDIRECT_OLD_PYLUCID_URL", False) == True: 
     101    # Redirect old PyLucid (with "index.py") to the new URLs. 
     102    # Only usefull, if you have a old PyLucid page used in the past ;) 
     103    urls += ( 
     104        r'^index.py(.*?)$', 'PyLucid.index.redirect' 
     105    ), 
     106 
     107 
     108# serve static files 
     109if getattr(settings, "SERVE_STATIC_FILES", False) == True: 
     110    # Should only enabled, if the django development server used. 
     111    urls += ( 
     112        '^%s(?P<path>.*)$' % settings.MEDIA_URL.lstrip("/"), 
     113        'django.views.static.serve', 
     114        {'document_root': './%s' % settings.MEDIA_URL}, 
     115    ), 
     116 
     117 
    113118urlpatterns = patterns('', *urls)