Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a modest CherryPy / SQLite application under development. I would like to put it on a server in the cloud for client testing. Towards that end I've spun up a small Ubuntu instance at Rackspace and done some preliminary installation (setup-tools and CherryPy).

Not being either an administrator or particularly familiar with Linux I have some rather simple questions about deploying this application that I haven't been able to answer using Google:

  1. I assume I should create a user account specifically to run the application rather than using root or any other existing account?

  2. I'm not sure where I should transplant my application folders. I'm guessing that they should go in /usr/user-I-created-question-1/. Is that correct?

  3. I'm using the CherryPy server which appears to be sufficient to my needs for this application. Is the correct approach to start the application in a putty session then kill the putty session on my Windows machine?

  4. Aside from visiting the site myself, what tools or techniques exist to monitor up-time, or to know if the server has become unavailable?

share|improve this question
add comment

1 Answer

You know, if it's only for testing for a limited amount of time, it's probably fine running the way you are talking about. Though it's probably also fine, under those circumstances, to run as any user. It's probably best to create a non-privileged user and have it run under that.

Where do you put it? Probably in a sub-directory of that users' home directory, like "/home/username/mywebapp".

You will probably want to run "screen" (apt-get install it if it isn't there), and run the web-app under that. You can re-attach with "screen -x" and you can detach from it with "Control-A COntrol-D". That way it won't die when you disconnect.

However, the way I would do it is to run it under Apache, so Apache starts and stops the app. It also then runs under the Apache user, which may be good or bad, but is usually good. Typically that would involve:

  • Using mod_wsgi.
  • Create a file in /etc/apache2/conf.d named after your application.

It should contain:

WSGIPythonPath /path/to/webapp/root
WSGIScriptAlias /appname /path/to/webapp/root/controller.py
  • In this case your webapp would be in the "controller.py" file. The "/appname" is the part of the URL that accesses this app, for example:
  • That webapp then needs to be a WSGI app, for example it should end with:

WSGI Example:

cfg = config()
application = cherrypy.APplication(None, script_name = '/appname', config = cfg)

The key thing is that you need to create an "application" object in your controller.

Once you do that, you should be able to restart Apache (/etc/init.d/apache2 restart) and then access the webapp via that URL.

share|improve this answer
Thank you very much for your detailed response. While this is just a testing and demonstration configuration now, the final deployment will also be to a cloud based virtual server (probably at Rackspace) and I was thinking of using the same setup (the server is dedicated to this single application). I've haven't enjoyed configuring Apache on the couple of occasions in the past when I've had to do it and, unlike Django, the CherryPy server seems to be intended for running production applications. Do you feel that's not appropriate? –  Larry Lustig Oct 18 '11 at 10:52
I don't honestly know if CherryPy's default server can stand up to load well. –  Sean Reifschneider Oct 21 '11 at 5:52
If this application ever gets five hits a minute, I'll be surprised. It's internal to a company planned to grow to five people, it collects narrative information so that each update will probably take a minute or two to create on the client side. It sounds like CherryPy will work for me. –  Larry Lustig Oct 21 '11 at 11:54
Ok, but how are you going to make sure that it is up when the system is rebooted? That's the nice thing about putting it in Apache, IMHO. –  Sean Reifschneider Oct 23 '11 at 3:19
Not sure, but I think one can use the cherryd script to ensure that the application starts on machine reboot. I'll be researching that this week. –  Larry Lustig Oct 23 '11 at 3:21
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.