Commits

Mark Lavin committed 3ac557b

Upgrading example project to django 1.3.

  • Participants
  • Parent commits ae84551

Comments (0)

Files changed (5)

File example/core/urls.py

-from django.conf.urls.defaults import *
+from django.conf.urls.defaults import patterns, url
 
 
 urlpatterns = patterns('example.core.views',

File example/manage.py

 #!/usr/bin/env python
 from django.core.management import execute_manager
+import imp
 try:
-    import settings # Assumed to be in the same directory.
+    imp.find_module('settings') # Assumed to be in the same directory.
 except ImportError:
     import sys
-    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
+    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
     sys.exit(1)
 
+import settings
+
 if __name__ == "__main__":
     execute_manager(settings)

File example/requirements.txt

-django>=1.2
-django-staticfiles==1.0rc1
+django>=1.3

File example/settings.py

 # Examples: "http://foo.com/media/", "/media/".
 ADMIN_MEDIA_PREFIX = '/static/admin/'
 
+# Additional locations of static files
+STATICFILES_DIRS = (
+    # Put strings here, like "/home/html/static" or "C:/www/django/static".
+    # Always use forward slashes, even on Windows.
+    # Don't forget to use absolute paths, not relative paths.
+    os.path.join(PROJECT_PATH, 'static'),
+)
+
 # Make this unique, and don't share it with anybody.
 SECRET_KEY = 'g2yn(u+9ue099hs@ap%n_j6nyxc5t*z8lq_avw_8ic_wnsytri'
 
 #     'django.template.loaders.eggs.Loader',
 )
 
-TEMPLATE_CONTEXT_PROCESSORS = (
-    "django.contrib.auth.context_processors.auth",
-    "django.core.context_processors.debug",
-    "django.core.context_processors.i18n",
-    "django.core.context_processors.media",
-    "django.core.context_processors.request",
-    "django.contrib.messages.context_processors.messages",
-    "staticfiles.context_processors.static",
-)
 
 MIDDLEWARE_CLASSES = (
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.messages',
+    'django.contrib.staticfiles',
     'django.contrib.admin',
-
-    'staticfiles',
     'selectable',
     'example.core',
 )
+
+
+# A sample logging configuration. The only tangible logging
+# performed by this configuration is to send an email to
+# the site admins on every HTTP 500 error.
+# See http://docs.djangoproject.com/en/dev/topics/logging for
+# more details on how to customize your logging configuration.
+LOGGING = {
+    'version': 1,
+    'disable_existing_loggers': False,
+    'handlers': {
+        'mail_admins': {
+            'level': 'ERROR',
+            'class': 'django.utils.log.AdminEmailHandler'
+        }
+    },
+    'loggers': {
+        'django.request': {
+            'handlers': ['mail_admins'],
+            'level': 'ERROR',
+            'propagate': True,
+        },
+    }
+}

File example/urls.py

-from django.conf.urls.defaults import *
+from django.conf.urls.defaults import patterns, include, url
 
-from staticfiles.urls import staticfiles_urlpatterns
 
 # Uncomment the next two lines to enable the admin:
 from django.contrib import admin
 
     # Uncomment the next line to enable the admin:
     (r'^admin/', include(admin.site.urls)),
-    (r'^_/', include('selectable.urls')),    
+    (r'^selectable/', include('selectable.urls')),    
     (r'^', include('example.core.urls')),    
 )
-
-urlpatterns += staticfiles_urlpatterns()