Changeset 8238


Ignore:
Timestamp:
15/04/12 20:36:38 (8 years ago)
Author:
spascoe
Message:

Added settings_local.py for overriding settings in local deployments.

settins_local.py is imported at the end of settings.py and can be used
to set database connections, etc.

New setting: SERVE_STATIC_CONTENT controls whether static URL patterns
are added in urls.py

Location:
mauRepo/MolesManager/trunk/src/MolesManager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/src/MolesManager/settings.py

    r8231 r8238  
    2727    'default': { 
    2828        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 
    29         #'NAME': 'c:/virtualenvs/www/MolesManager/src/sqlite.db', #'/misc/frigid3/humid1/mnagni/workspaces/moles3/MolesManager/src/sqlite.db',                      # Or path to database file if using sqlite3. 
    30         'NAME': '/misc/frigid3/humid1/mnagni/workspaces/moles3/MolesManager/src/sqlite.db',                      # Or path to database file if using sqlite3. 
     29        'NAME': PROJECT_ROOT+'/sqlite.db',                      # Or path to database file if using sqlite3. 
    3130        'USER': '',                      # Not used with sqlite3. 
    3231        'PASSWORD': '',                  # Not used with sqlite3. 
     
    229228#Default to one day 
    230229MIGRATION_INTERVAL = 86400 
     230 
     231# Set this boolean to include static URL patterns for CSS, JS, etc. in urls.py 
     232SERVE_STATIC_CONTENT = False 
     233 
     234# Local modifications to settings are imported from settings_local.py 
     235from settings_local import * 
  • mauRepo/MolesManager/trunk/src/MolesManager/urls.py

    r8236 r8238  
    1 from django.conf.urls.defaults import patterns 
     1from django.conf.urls.defaults import patterns, url 
     2from settings import SERVE_STATIC_CONTENT, STATIC_ROOT 
    23 
    34# Uncomment the next two lines to enable the admin: 
     
    3738) 
    3839 
    39 # comment out all  below 
     40if SERVE_STATIC_CONTENT: 
     41    urlpatterns += patterns('', 
     42       url(r'css/(?P<path>.*)$', 'django.views.static.serve', {'document_root': STATIC_ROOT+'/css' , 'show_indexes': True}), 
     43    ) 
    4044 
    41 #urlpatterns += patterns('', 
    42 #    url(r'css/(?P<path>.*)$', 'django.views.static.serve', {'document_root': STATIC_ROOT+'/css' , 'show_indexes': True}), 
    43 #) 
     45    urlpatterns += patterns('', 
     46       url(r'css/960/(?P<path>.*)$', 'django.views.static.serve', {'document_root': STATIC_ROOT+'/css/960' , 'show_indexes': True}), 
     47    ) 
    4448 
    45 #urlpatterns += patterns('', 
    46 #    url(r'css/960/(?P<path>.*)$', 'django.views.static.serve', {'document_root': STATIC_ROOT+'/css/960' , 'show_indexes': True}), 
    47 #) 
     49    urlpatterns += patterns('', 
     50       url(r'img/(?P<path>.*)$', 'django.views.static.serve', {'document_root': STATIC_ROOT+'/img' , 'show_indexes': True}), 
     51    ) 
    4852 
    49 #urlpatterns += patterns('', 
    50 #    url(r'img/(?P<path>.*)$', 'django.views.static.serve', {'document_root': STATIC_ROOT+'/img' , 'show_indexes': True}), 
    51 #) 
     53    urlpatterns += patterns('', 
     54       url(r'js/(?P<path>.*)$', 'django.views.static.serve', {'document_root': STATIC_ROOT+'/js' , 'show_indexes': True}), 
     55    ) 
    5256 
    53 #urlpatterns += patterns('', 
    54 #    url(r'js/(?P<path>.*)$', 'django.views.static.serve', {'document_root': STATIC_ROOT+'/js' , 'show_indexes': True}), 
    55 #) 
    56 #urlpatterns += staticfiles_urlpatterns() 
Note: See TracChangeset for help on using the changeset viewer.