Smisk and Nginx

3 views
Skip to first unread message

Atilla

unread,
Mar 30, 2009, 1:40:56 PM3/30/09
to Smisk
I've recently found out about Smisk and I'm very curious to experiment
with it. I've a small project going fairly well for now, but I want to
host it on a host where my server is Nginx.

Now, Nginx supports fcgi, however it doesn't spawn or control
processes itself, which is a small problem. I can't seem to find a
consistent way people spawn FCGI processes, especially Python
processes. I was experimenting with spawn-fcgi, which is essentially
the code from lighty's fcgi module, but I can't seem to make it to run
the example applications.

I've been wondering if there are any other suitable C or Python based
tools or libraries I could use to run a concurrent FCGI server,
somehting that won't be too heavy of a dependency, in comparision to
Smisk and Nginx?

Rasmus Andersson

unread,
Mar 30, 2009, 4:33:42 PM3/30/09
to smisk-...@googlegroups.com
Hi Atilla!

Actually, you can start a smisk process as a stand-alone (FastCGI)
server. Create this file and save it as process.py:

from smisk.core import *
class MyApp(Application):
def service(self):
self.response('hello')

from smisk.util.main import main
main(MyApp)

Now, try running the script with --help:

$ python process.py --help
Usage: process.py [options]

Options:
-h, --help show this help message and exit
-d PATH, --appdir=PATH
Set the application directory. Not set by default.
-b ADDR, --bind=ADDR Start a stand-alone process, listening for FastCGI
connection on ADD, which can be a TCP/IP address with
out without host or a UNIX socket (named pipe on
Windows). For example "localhost:5000",
"/tmp/my_process.sock" or ":5000". Not set by default.
-c N, --forks=N Set number of childs to fork. Not set by default.
--debug sets log level to DEBUG

You want to start your process.py with at least the --bind argument:

$ python process.py --bind=127.0.0.1:5000

In production, it's a good idea to have your Smisk server(s) managed
by a process manager. If you're on Debian, that means an
init.d-script. On OS X it's a launchd-script, and so on.
--
Rasmus Andersson

Atilla

unread,
Mar 30, 2009, 7:03:42 PM3/30/09
to smisk-...@googlegroups.com
Hi Rasmus,

Thanks, I've completely missed that out. I just assumed in the hurry
that the framework expects an already established FCGI environment,
due to the initial error message I saw and didn't really look any
further in the code to check.

This is completely enough for what I need and quite the good start, thank you.

2009/3/30 Rasmus Andersson <ras...@flajm.com>:
Reply all
Reply to author
Forward
0 new messages