Changeset 1320

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

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

Location:
trunk/pylucid/PyLucid
Files:
2 modified

Legend:

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

    r1300 r1320  
    154154# STATIC FILES 
    155155# http://www.djangoproject.com/documentation/static_files/ 
    156 # 
     156 
     157# Serve static files for the development server? 
     158# Using this method is inefficient and insecure. 
     159# Do not use this in a production setting. Use this only for development. 
     160SERVE_STATIC_FILES = False 
     161 
    157162# Note: Every URL/path... 
    158163# ...must be a absolute path. 
     
    370375# Should be only enabled for tests. It is a big security hole! 
    371376INSTALL_EVILEVAL = False 
     377 
     378# Permit sending mails with the EMailSystem Plugin: 
     379ALLOW_SEND_MAILS = True 
     380 
     381# Every Plugin output gets a html SPAN tag around. 
     382# Here you can defined witch CSS class name the tag should used: 
     383CSS_PLUGIN_CLASS_NAME = "PyLucidPlugins" 
     384 
     385 
    372386 
    373387# The table prefix from a old PyLucid installation, if exist. 
     
    386400# Use "low level admin/User administration" to set a new password for the user. 
    387401 
    388 # Permit sending mails with the EMailSystem Plugin: 
    389 ALLOW_SEND_MAILS = True 
    390  
    391 # Every Plugin output gets a html SPAN tag around. 
    392 # Here you can defined witch CSS class name the tag should used: 
    393 CSS_PLUGIN_CLASS_NAME = "PyLucidPlugins" 
     402# If you used a old PyLucid installation then you can recirect the old 
     403# urls with "indey.py" to the new URLs without the "index.py" part. 
     404# Default: False 
     405REDIRECT_OLD_PYLUCID_URL = False 
  • 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)