added capability of serving static files .
authornishanth
Tue, 23 Feb 2010 20:40:55 +0530
changeset 62 db103856505e
parent 61 708dd49d531b
child 63 1fc027bf99ee
added capability of serving static files .
settings.py
urls.py
--- a/settings.py	Tue Feb 23 20:24:26 2010 +0530
+++ b/settings.py	Tue Feb 23 20:40:55 2010 +0530
@@ -35,12 +35,12 @@
 
 # Absolute path to the directory that holds media.
 # Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = ''
+MEDIA_ROOT = './images/'
 
 # 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 = ''
+MEDIA_URL = 'http://localhost:8000/images/'
 
 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
 # trailing slash.
--- a/urls.py	Tue Feb 23 20:24:26 2010 +0530
+++ b/urls.py	Tue Feb 23 20:40:55 2010 +0530
@@ -17,7 +17,10 @@
     # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
     # to INSTALLED_APPS to enable admin documentation:
     # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
-    
+
+    (r'^images/(?P<path>.*)$', 'django.views.static.serve',
+            {'document_root': './images/'}),
+
     (r'^$', userViews.homepage),
     
     (r'^task/browse/$', taskViews.browse_tasks),