Commits

Charl Botha  committed a2dda27

Fixed a bug in process staticfiles and changes STATICFILES_URL and STATICFILES_ROOT to just STATIC_* as per Django 1.3 docs.

  • Participants
  • Parent commits d677974

Comments (0)

Files changed (1)

File django_wsgiserver/management/commands/runwsgiserver.py

     staticlocations=[]
     for staticdir in staticfiles_dirs:
         if isinstance(staticdir, (list, tuple)):
-            prefix, root = root
+            prefix, root = staticdir
         else:
             prefix = ''
+            root = staticdir
+            
         staticlocations.append((prefix, root))
     return staticlocations
 
 
     if options['staticserve']:
         try:
-            path[settings.STATICFILES_URL] = mediahandler.MediaHandler(settings.STATICFILES_ROOT)        
+            path[settings.STATIC_URL] = mediahandler.MediaHandler(settings.STATIC_ROOT)        
         except AttributeError, msg:
             print msg
             print "****"
-            print "STATICFILES_URL and STATICFILES_ROOT  must be set in settings file"
+            print "STATIC_URL and STATIC_ROOT  must be set in settings file"
             print "****"
             raise
-
-        try:
-            staticserverapp = mediahandler.MediaHandler(settings.STATICFILES_ROOT)
-            path[settings.STATICFILES_URL] = staticserverapp
-        except AttributeError, msg:
-            print msg
-            print "****"
-            print "STATICFILES_ROOT and STATICFILES_URL are not set in settings file"
-            print "Continuing anyway..."
-            print "****"
                  
-        if options['servestaticdirs'] and settings.__dict__.has_key('STATICFILES_DIRS'):
+        if options['servestaticdirs'] and hasattr(settings, 'STATICFILES_DIRS'):
             staticlocations = process_staticfiles_dirs(settings.STATICFILES_DIRS)
             # print staticlocations
             for urlprefix, root in staticlocations:
-                path[os.path.join(settings.STATICFILES_URL, urlprefix)] =  mediahandler.MediaHandler(root)
-                 
+                path[os.path.join(settings.STATIC_URL, urlprefix)] =  mediahandler.MediaHandler(root)
+        
     dispatcher =  WSGIPathInfoDispatcher( path )
         
     server = CherryPyWSGIServer(