Search code examples
pythonvirtualhostcherrypybottle

How to use CherrPy as Web server and Bottle as Application to support multiple virtual hosts?


I have a website (which running in Amazon EC2 Instance) running Python Bottle application with CherryPy as its front end web server.

Now I need to add another website with a different domain name already registered. To reduce the cost, I want to utilize the existing website host to do that.

Obviously, virtual host is the solution.

I know Apache mod_wsgi could play the trick. But I don't want to replace CherryPy.

I've googled a a lot, there are some articles showing how to make virtual hosts on CherryPy, but they all assume Cherrypy as Web Sever + Web application, Not CherrPy as Web server and Bottle as Application.

How to use CherrPy as Web server and Bottle as Application to support multiple virtual hosts?


Solution

  • As you mentioned, use VirtualHost. In the example cherrypy.Application instances are used, but any WSGI callable (e. g. Bottle app) will do.