1. pombredanne
  2. django-wsgiserver3

Commits

clee  committed 03fba8b

add admin media serving by default

  • Participants
  • Parent commits bd4d838
  • Branches default

Comments (0)

Files changed (2)

File django_wsgiserver/management/commands/runwsgiserver.py

View file
                         Defaults to www-data
   server_group=STRING   group to daemonized process
                         Defaults to www-data
+  adminserve=True|False  Serve the admin media automatically. Useful in
+                         development. Defaults to True so turn to False if
+                         using in production.
 
 Examples:
   Run a "standard" CherryPy wsgi server
 'ssl_certificate': None,
 'ssl_private_key': None,
 'autoreload' : False,
+'adminserve' : True,  # please serve the admin media too by default
 }
 
 
     from django_wsgiserver.wsgiserver import CherryPyWSGIServer as Server
     #from cherrypy.wsgiserver import CherryPyWSGIServer as Server
     from django.core.handlers.wsgi import WSGIHandler
+    app = WSGIHandler()
+    if options['adminserve']: # serve the admin media too
+        # AdminMediaHandler is middleware for local use
+        import django.core.servers.basehttp
+        app = django.core.servers.basehttp.AdminMediaHandler(app)
+        print "adding the AdminMediaHandler middleware"
+        
     server = Server(
         (options['host'], int(options['port'])),
-        WSGIHandler(), 
+        app,
         int(options['threads']), 
         options['server_name']
     )
             k, v = x.split('=', 1)
         else:
             k, v = x, True
+        if v=='False' or v=='false':
+            v = False
+            # print "found false", v
         options[k.lower()] = v
-    
+        
     if "help" in options:
         print CPWSGI_HELP
         return

File setup.py

View file
 # modified version no cherrypy reliance
 setup(
     name="django-wsgiserver",
-    version="0.6.3",
+    version="0.6.4",
     description="""django-wsgiserver installs a web server for Django using CherryPy's WSGI server.""",
     author="""Peter Baumgartner Chris Lee-Messer the authors of CherryPy""",
     author_email="pete@lincolnloop.com, chris@lee-messer.net",