views:

262

answers:

3

I need to start the blog demo in the following ports:

127.0.0.1:8000 127.0.0.1:8001 127.0.0.1:8002 127.0.0.1:8003

When I run the application using:

./demos/blog/blog.py

it starts in port 8888 as defined by:

define("port", default=8888, help="run on the given port", type=int)

How do I run multiple instances in multiple ports?

Thanks

Seb

A: 

I found what I was looking for:

./demos/blog/blog.py --port=8889
A: 

copy /demos/blog/blog.py to blog_otherports.py

change posts in blog_otherports.py

and python blog_otherports.py

you need to run two processes

bower
adding a runtime option that configures the port is all that is necessary. there is also now a commit on github that lets tornado fork off one process per core in your machine.
Carson
+1  A: 

Make sure you know, the --port option gets parsed by the options module of the Tornado framework.

The lines that looks like this:

define("port", default=8888, help="Port to listen on", type=int)

and later there's a call to the options module that parses command line vars automatically.

I'm just giving you this because you might want to later specify different variables in your programs that you design around the framework that you may want to change instance to instance.

Crowe T. Robot