# Path: pyas2/pyas2init.py
# def initialize():
# def initserverlogging(logname):


from django.core.management.base import BaseCommand
from django.core.handlers.wsgi import WSGIHandler
from django.utils.translation import ugettext as _
from pyas2 import pyas2init
            from cherrypy import wsgiserver
import pyas2
import os
            import cherrypy
                'tools.staticdir.on': True,
                'tools.staticdir.dir': 'static',
                'tools.staticdir.root': os.path.abspath(
                    os.path.dirname(pyas2.__file__))
            }
        }
        servestaticfiles = cherrypy.tree.mount(None, '/static', conf)

        # cherrypy handling of django
        # was: servedjango = AdminMediaHandler(WSGIHandler())
        # but django does not need the AdminMediaHandler in this setup. is much faster.
        servedjango = WSGIHandler()

        # cherrypy uses a dispatcher in order to handle the serving of
        # static files and django.
        dispatcher = wsgiserver.WSGIPathInfoDispatcher(
            {'/': servedjango, '/static': servestaticfiles})

        pyas2server = wsgiserver.CherryPyWSGIServer(
            bind_addr=('0.0.0.0', pyas2init.gsettings['port']),
            wsgi_app=dispatcher,
            server_name='pyas2-webserver'
        )

        pyas2init.logger.log(
            25, _(u'PyAS2 server running at port: "%s".' % pyas2init.gsettings['port']))

        # handle ssl: cherrypy < 3.2 always uses pyOpenssl. cherrypy >= 3.2
        # uses python buildin ssl (python >= 2.6 has buildin support for ssl).
        ssl_certificate = pyas2init.gsettings['ssl_certificate']

# Path: pyas2/pyas2init.py
# def initialize():
# def initserverlogging(logname):


# Path: pyas2/management/commands/runas2server.py
from django.core.management.base import BaseCommand
from django.core.handlers.wsgi import WSGIHandler
from django.utils.translation import ugettext as _
from pyas2 import pyas2init
            from cherrypy import wsgiserver
import pyas2
import os
            import cherrypy

                'tools.staticdir.on': True,
                'tools.staticdir.dir': 'static',
                'tools.staticdir.root': os.path.abspath(
                    os.path.dirname(pyas2.__file__))
            }
        }
        servestaticfiles = cherrypy.tree.mount(None, '/static', conf)

        # cherrypy handling of django
        # was: servedjango = AdminMediaHandler(WSGIHandler())
        # but django does not need the AdminMediaHandler in this setup. is much faster.
        servedjango = WSGIHandler()

        # cherrypy uses a dispatcher in order to handle the serving of
        # static files and django.
        dispatcher = wsgiserver.WSGIPathInfoDispatcher(
            {'/': servedjango, '/static': servestaticfiles})

        pyas2server = wsgiserver.CherryPyWSGIServer(
            bind_addr=('0.0.0.0', pyas2init.gsettings['port']),
            wsgi_app=dispatcher,
            server_name='pyas2-webserver'
        )

        pyas2init.logger.log(
            25, _(u'PyAS2 server running at port: "%s".' % pyas2init.gsettings['port']))

        # handle ssl: cherrypy < 3.2 always uses pyOpenssl. cherrypy >= 3.2
        # uses python buildin ssl (python >= 2.6 has buildin support for ssl).
        ssl_certificate = pyas2init.gsettings['ssl_certificate']

        ssl_private_key = pyas2init.gsettings['ssl_private_key']