From fd5f0c3c4c78ec48c8c73161dac89adaf818cbf8 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 23 May 2012 13:54:36 +0000 Subject: [PATCH] upgrade to django 1.4 --- etc/apache2/vhost.conf.in | 2 +- etc/nginx/vhost.in | 8 ++++---- pandora/settings.py | 34 +++++++++++++++++++++++----------- pandora/urls.py | 2 ++ requirements.txt | 4 ++-- 5 files changed, 32 insertions(+), 18 deletions(-) diff --git a/etc/apache2/vhost.conf.in b/etc/apache2/vhost.conf.in index 59dd098e..5ab2d8a4 100644 --- a/etc/apache2/vhost.conf.in +++ b/etc/apache2/vhost.conf.in @@ -32,7 +32,7 @@ Alias /static __PREFIX__/static Alias /favicon.ico __PREFIX__/static/favicon.ico Alias /data __PREFIX__/data - Alias /admin/media __PREFIX__/src/django/django/contrib/admin/media + Alias /static/admin __PREFIX__/django/django/contrib/admin ProxyPreserveHost On ProxyPass / http://127.0.0.1:2620/ diff --git a/etc/nginx/vhost.in b/etc/nginx/vhost.in index 6f79a41f..058dd887 100644 --- a/etc/nginx/vhost.in +++ b/etc/nginx/vhost.in @@ -20,14 +20,14 @@ server { access_log /var/log/nginx/pandora.access.log; error_log /var/log/nginx/pandora.error.log; - location /admin/media { - root __PREFIX__/src/django/django/contrib; - autoindex on; - } location /favicon.ico { root __PREFIX__/static; } + location /static/admin/ { + root __PREFIX__/django/django/contrib/admin; + autoindex on; + } location /static/ { root __PREFIX__; autoindex on; diff --git a/pandora/settings.py b/pandora/settings.py index 2834b8eb..1223b7fd 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -42,21 +42,29 @@ APPEND_SLASH = False # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = normpath(join(PROJECT_ROOT, '..', 'data')) -STATIC_ROOT = normpath(join(PROJECT_ROOT, '..', 'static')) -GEOIP_PATH = normpath(join(PROJECT_ROOT, '..', 'data', 'geo')) - -# URL that handles the media served from MEDIA_ROOT. Make sure to use a -# trailing slash if there is a path component (optional in other cases). -# Examples: "http://media.lawrence.com", "http://example.com/media/" - MEDIA_URL = '/data/' +STATIC_ROOT = normpath(join(PROJECT_ROOT, '..', 'static')) STATIC_URL = '/static/' +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. +) + +# List of finder classes that know how to find static files in +# various locations. +STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', + #'django.contrib.staticfiles.finders.DefaultStorageFinder', +) + +GEOIP_PATH = normpath(join(PROJECT_ROOT, '..', 'data', 'geo')) -# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a -# trailing slash. -# Examples: "http://foo.com/media/", "/media/". -ADMIN_MEDIA_PREFIX = '/admin/media/' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( @@ -85,7 +93,11 @@ INSTALLED_APPS = ( 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', + 'django.contrib.messages', + 'django.contrib.staticfiles', 'django.contrib.admin', + # Uncomment the next line to enable admin documentation: + # 'django.contrib.admindocs', 'django.contrib.humanize', 'django_extensions', diff --git a/pandora/urls.py b/pandora/urls.py index a831e30e..0f5d50e0 100644 --- a/pandora/urls.py +++ b/pandora/urls.py @@ -20,6 +20,8 @@ def serve_static_file(path, location, content_type): return HttpFileResponse(location, content_type=content_type) urlpatterns = patterns('', + # Uncomment the admin/doc line below to enable admin documentation: + # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), (r'^admin/', include(admin.site.urls)), (r'^api/upload/?$', 'archive.views.firefogg_upload'), (r'^url=(?P.*)$', 'app.views.redirect_url'), diff --git a/requirements.txt b/requirements.txt index fc79fc80..87d12f76 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ --e svn+http://code.djangoproject.com/svn/django/branches/releases/1.3.X#egg=django +-e git+https://github.com/django/django.git@stable/1.4.x#egg=django #South -e bzr+http://code.0x2620.org/python-ox/#egg=python-ox -e bzr+http://code.0x2620.org/oxtimelines/#egg=oxtimelines @@ -11,5 +11,5 @@ django-celery>=2.4.2 #use fork fixing some postgresql issues -e git://github.com/bit/django-extensions.git#egg=django_extensions -e git+git://github.com/dcramer/django-devserver#egg=django_devserver -gunicorn +gunicorn>=0.14.3 html5lib