views:

196

answers:

2

Hi,

I'm quite new to using Tornado Web as a web server, and am having a little difficulty keeping it running. I normally use Django and Nginx, and am used to start/stop/restarting the server. However with Tornado I'm having trouble telling it to "run" without directly executing my main python file for the site, ie "python ~/path/to/server.py".

I'm sure I'm getting this completely wrong - is there a way of 'bootstrapping' my script so that when Nginx starts, Tornado starts?

Any help would be appreciated!

+1  A: 

No, there is not a way to have nginx spawn your tornado instance.

Typically you would use an external framework like daemontools or a system init script to run the tornado process.

Jehiah
Additionally an init script is a SysV standard and generally expected by others as a standard mechanism to start and stop your service. Alternatives would be upstart or the Solaris equivalent.
nailer
+2  A: 

A better way to do it is using supervisord as it is also written in python

jpartogi
A language choice doesn't make something better on it's own; daemontools is rock solid. I was also only suggesting something 'like' daemontools, clearly there is a long list of options (including supervisord).
Jehiah
It's better for his needs despite that it might not be better than daemontools.
jpartogi