cleemesser committed f8587fe

use ssl_adapter as suggested by cherrpy

Comments (0)

Files changed (1)


 logger = logging.getLogger('django')
 from socket import gethostname
 from import BaseCommand
-from django_wsgiserver import mediahandler
+import django_wsgiserver.mediahandler
+from django_wsgiserver import wsgiserver
   Run this project in CherryPy's production quality http webserver.
         #     if settings.__dict__.has_key('ADMIN_MEDIA_PREFIX'):
         #         import django.contrib.admin
-        #         path[settings.ADMIN_MEDIA_PREFIX] = mediahandler.MediaHandler(        
+        #         path[settings.ADMIN_MEDIA_PREFIX] = django_wsgiserver.mediahandler.MediaHandler(        
         #             os.path.join( django.contrib.admin.__path__[0], 'media'))
         #     else:
         #         print "Warning adminserve was selected BUT ADMIN_MEDIA_PREFIX was not defined"
                         full_static_url = os.path.join(settings.STATIC_URL,app_url)
                         full_dir_location = os.path.join(val.location,app_url)
                         logger.debug(full_static_url, full_dir_location)
-                        path[full_static_url] = mediahandler.MediaHandler(full_dir_location)
+                        path[full_static_url] = django_wsgiserver.mediahandler.MediaHandler(full_dir_location)
             if options['servestaticdirs'] and hasattr(settings, 'STATICFILES_DIRS'):
                 # debug !!!
                 logger.debug("staticlocations::"); logger.debug(pformat(staticlocations))
                 for urlprefix, root in staticlocations:
-                    path[os.path.join(settings.STATIC_URL, urlprefix)] =  mediahandler.MediaHandler(root)
+                    path[os.path.join(settings.STATIC_URL, urlprefix)] =  django_wsgiserver.mediahandler.MediaHandler(root)
             # One important thing is that there are two different ways to serve the static files
             # 1. convenient: serve each app's static files (assuming they follow convention)
             if options['staticserve'] == 'collectstatic':
                 # and serve the root of the STATIC_URL ? hmm !!!
-                path[settings.STATIC_URL] = mediahandler.MediaHandler(settings.STATIC_ROOT)
+                path[settings.STATIC_URL] = django_wsgiserver.mediahandler.MediaHandler(settings.STATIC_ROOT)
                 logger.warning("serving all static files from %s. *** Make sure you have done a fresh collectstatic operation ***" % settings.STATIC_ROOT)
         # debug
         if options['ssl_certificate'] and options['ssl_private_key']:
-            server.ssl_certificate = options['ssl_certificate']
-            server.ssl_private_key = options['ssl_private_key']  
+            Adapter = wsgiserver.get_ssl_adapter_class()
+            server.ssl_adapter = Adapter(certificate=options['ssl_certificate'],
+                                         private_key=options['ssl_private_key'])
         except KeyboardInterrupt:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.