Deploying CherryPy application using gunicorn

I have a basic application written in CherryPy. It looks something like this:

import cherrypy

class API():
    @cherrypy.expose
    def index(self):
        return "<h3>Its working!<h3>"

if __name__ == '__main__':
    cherrypy.config.update({
        'server.socket_host': '127.0.0.1',
        'server.socket_port': 8082,
    })
    cherrypy.quickstart(API())

      

I would like to deploy this application with a cannon, possibly with multiple workers. gunicorn starts up when I run this in terminal

gunicorn -b localhost:8082 -w 4 test_app:API 

      

But every time I try to access the default method it gives an internal server error. However, running this standalone using CherryPy works.

Here is the error:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/sync.py", line 130, in handle
    self.handle_request(listener, req, client, addr)
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/sync.py", line 171, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
TypeError: this constructor takes no arguments

      

I have a fairly large CherryPy application that I would like to deploy using gunicorn. Should CherryPy and gunicorn be mixed?

+3
python python-2.7 cherrypy gunicorn


source to share


No one has answered this question yet

Check out similar questions:

18
SQLalchemy cannot find table to create foreign key
eleven
failed in "sudo pip"
five
How do I determine the .LOGGING settings so gunicorn finds the correct version?
3
Installing AWS flexiblebeanstalk command line tool in ubuntu: error Distribution 'awsebcli == 3.10.0' was not found and is required by the application
1
Linux package package installation error
1
Python code issue AttributeError: 'NoneType' object has no 'title' attribute
0
Set tensorflow through pip, but not as shown below.
0
Why does cherrypy say the port is not free, even if it is an unused port?
0
memory error initial api cap model with gun running on AWS
-1
Should I run a regular flash application and sockets on the same ports?



All Articles
Loading...
X
Show
Funny
Dev
Pics