Search code examples
pythonpython-3.xgunicornbottle

Unable to run (Python) bottle app using gunicorn


I am just getting started with Bottle. I have found a sample app on GitHub. The sample just has a server.py file which looks like below

import bottle

APP = bottle.Bottle()

@APP.get('/')
def index():
  return '<p>Hello</p>'

if __name__ == '__main__':
  bottle.run(application=APP)

The requirements.txt file has

bottle
gunicorn

as dependencies. I am using Python 3.7.2. After running pip install -r requirements.txt, I ran python server.py. The server starts up without error on Port 8080

I tried running the server using gunicorn as below

gunicorn -w 2 -b 0.0.0.0:8080 server:app    

This gives an error and the server doesn't start. What's wrong with the gunicorn command?


Solution

  • gunicorn -w 2 -b 0.0.0.0:8080 server:APP

    Thanks to Klaus D for pointing out