Today, I’m going to show you how to start up your Tornado apps at
boot using upstart. For path names, I’m assuming some modern
version of Ubuntu, such as 9.10 or higher. I’m also assuming that you
have some project with an executable Python script that fires up the
Tornado app. I usually have one file in all of my projects called
web.py
.
The important part of this file looks like this (mind the application and port variables):
1 2 3 4 |
|
Got that in place? Good. Next, make a system user for your project to run
as. In my example, I’ll be using projectuser
as the username. Creating this
user can be done like so:
1
|
|
Finally, create the file /etc/init/web.conf
. It’s
very important that this filename ends in .conf. The contents of this
file should be as follows:
1 2 3 4 5 6 7 8 9 |
|
That’s it! You can start your Tornado app by entering the command:
sudo start web
. If successful, you should see output similar to:
` ** web start/running, process 28058. You can also stop your projects using
the command
sudo stop web`.