dns-lg icon indicating copy to clipboard operation
dns-lg copied to clipboard

Using other WSGI servers

Open joncodis opened this issue 11 years ago • 0 comments

I had no issues getting this great project to run on Apache, but I wanted to use something more lightweight. Tried a few different servers, but application would not run properly. I am not a Python programmer, but hacked at it and got it to work on FAPWS (http://www.fapws.org/) and CherryPy (http://docs.cherrypy.org/stable/refman/wsgiserver/init.html).

Providing my diff below...such as it is, in case it is of any interest. Works for me, but I'm sure some better fixes could be made.

Patch to _init_.py

123c123,124

< raise Exception("Internal error: no / at the beginning of %s" % path)

        path = '/' + path
        # raise Exception("Internal error: no / at the beginning of %s" % path)

398c399

< return self.query(start_response, Request(environ), pure_path, client, format, resolver,

        return self.query(start_response, Request(dict(environ)), pure_path, client, format, resolver,

CherryPy test server code..

!/usr/bin/env python

from cherrypy import wsgiserver import DNSLG

port = 8080 email_admin = "foobar@invalid" url_doc = None url_css = None

querier = DNSLG.Querier(email_admin, url_doc, url_css) wsgi_app = querier.application

server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 8080), wsgi_app, request_queue_size=500, server_name='localhost')

if name == 'main': try: server.start() except KeyboardInterrupt: server.stop()

FAPWS test server code

!/usr/bin/env python

import fapws._evwsgi as evwsgi from fapws import base from fapws.contrib import cgiapp import DNSLG

port = 8080 email_admin = "[email protected]" url_doc = None url_css = None

def start(): evwsgi.start("0.0.0.0", "8080") evwsgi.set_base_module(base)

querier = DNSLG.Querier(email_admin, url_doc, url_css)
evwsgi.wsgi_cb(("/",querier.application))

evwsgi.set_debug(0)
evwsgi.run()

if name=="main": start()

joncodis avatar Apr 01 '13 18:04 joncodis