Commits

Anonymous committed 5db39ff

Django 1.4 compatible settings and cleanup

  • Participants
  • Parent commits 229e362

Comments (0)

Files changed (8)

etc/settings/database.py

 from .generic import PROJECT_ROOT, PROJECT, DJANGO_PROJECT
 
 
-DATABASE_NAME = PROJECT + '_' + DJANGO_PROJECT
+DATABASE_NAME = PROJECT
 
 DATABASES_DEFAULT = {
     'default_sqlite': {
     'default_mysql': {
         'ENGINE': 'django.db.backends.mysql',
         'NAME': DATABASE_NAME,
-        'USER': 'gjsb',
+        'USER': 'mysql',
     },
     'default_postgres': {
         'ENGINE': 'django.db.backends.postgresql_psycopg2',
         'NAME': DATABASE_NAME,
-        'USER': 'gjsb',
+        'USER': 'postgres',
     }
 }
 

etc/settings/generic.py

 USE_I18N = False
 USE_L10N = False
 
-SERVE_DOCS = False
-SERVE_MEDIA = False
-MEDIA_ID = 'static'
+STATIC_ID = 'static'
+STATIC_ROOT = path.join(DJANGO_PROJECT_DIR, STATIC_ID)
+STATIC_URL = '/%s/' % STATIC_ID
+MEDIA_ID = 'media'
 MEDIA_ROOT = path.join(DJANGO_PROJECT_DIR, MEDIA_ID)
 MEDIA_URL = '/%s/' % MEDIA_ID
-ADMIN_MEDIA_PREFIX = '/adminmedia/'
 
 ROOT_URLCONF = DJANGO_PROJECT + '.urls'
 

etc/settings/log.py

 from os import path
 import logging
 
-from .generic import PROJECT_ROOT, DJANGO_PROJECT
+from .generic import PROJECT_ROOT, PROJECT
 
 
-LOGGING_FILENAME = path.join(PROJECT_ROOT, 'log/%s.log' % DJANGO_PROJECT)
+LOGGING_FILENAME = path.join(PROJECT_ROOT, 'log/%s.log' % PROJECT)
 
 logging.basicConfig(
     level=logging.DEBUG,

etc/settings/template.py

-from os import path
-
 from .generic import DJANGO_PROJECT_DIR
 
 
     'django.core.context_processors.debug',
     'django.core.context_processors.i18n',
     'django.core.context_processors.media',
-    #'django.core.context_processors.static', # Django 1.3
+    'django.core.context_processors.static',
+    'django.core.context_processors.tz'
     'django.contrib.messages.context_processors.messages',
 )
 
 admin.autodiscover()
 
 default_patterns = patterns('',
-    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
-    (r'^admin/', include(admin.site.urls)),
-    (r'^databrowse/(.*)', databrowse.site.root),
-    (r'^%s$' % settings.LOGIN_URL[1:], 'django.contrib.auth.views.login',
+    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
+    url(r'^admin/', include(admin.site.urls)),
+    url(r'^databrowse/(.*)', databrowse.site.root),
+    url(r'^%s$' % settings.LOGIN_URL[1:], 'django.contrib.auth.views.login',
          {'template_name': 'admin/login.html'})
 )
-
-if getattr(settings, 'ADMIN_SITE', False):
-    default_patterns += patterns('django.views.generic.simple',
-        ('^$', 'redirect_to', {'url': '/admin/'}),
-    )
-
-if settings.SERVE_MEDIA:
-    default_patterns += patterns('',
-        (r'^%s/(?P<path>.*)$' % settings.MEDIA_ID, 'django.views.static.serve',
-         {'document_root': settings.MEDIA_ROOT, 'show_indexes': False}),
-    )

mysite/settings/env/development.py

 
 DEBUG = True
 
-SERVE_MEDIA = True
-
 INSTALLED_APPS += (
     'django.contrib.databrowse',
     #'debug_toolbar',

mysite/settings/env/production_generic.py

 
 DEBUG = False
 
-SERVE_MEDIA = False
-
 COMPRESS = True
 
 SEND_BROKEN_LINK_EMAILS = True
 
 ROSETTA_WSGI_AUTO_RELOAD = False
 
-GOOGLE_ANALYTICS_CODE = 'UA-XXX'
-
-CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
-CACHE_MIDDLEWARE_SECONDS = 86400
-CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
-
 from os import path
 
 try:

mysite/settings/env/staging.py

 
 DEBUG = False
 
-SERVE_MEDIA = False
-
 COMPRESS = True
 
 SEND_BROKEN_LINK_EMAILS = False
 
 ROSETTA_WSGI_AUTO_RELOAD = True
 
-GOOGLE_ANALYTICS_CODE = 'UA-XXX'
-
-CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
-CACHE_MIDDLEWARE_SECONDS = 60
-CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
-
 from os import path
 
 try: