I'm trying to run webpy as fastCgi inside lighttpd in my Debian system. Webpy asked for Flup and cheroot in order to work, so I created a virtual environment and I managed to have it running inside the venv (where I installed Flup and cheroot using pip), using those commands:
source .venv/bin/activate
python code.py
This way it runs (the file code.py contains the source code showed in the webpy tutorial). I was forced to install the packages using pip and venv because if I try to install python packages from apt I receive the PEP668 EXTERNALLY-MANAGED error.
What I'm trying to do is to have it run served by lighttpd. I modified the /etc/lighttpd/conf-available/10-fastcgi.conf as follows:
# /usr/share/doc/lighttpd/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi
server.modules += ( "mod_fastcgi" )
server.modules += ( "mod_rewrite" )
fastcgi.server = ( "/code.py" =>
(( "socket" => "/tmp/fastcgi.socket",
"bin-path" => "/var/www/ltm/.venv/bin/python3 /var/www/ltm/code.py",
"max-procs" => 1,
"bin-environment" => (
"REAL_SCRIPT_NAME" => ""
),
"check-local" => "disable"
))
)
url.rewrite-once = (
"^/favicon.ico$" => "/static/favicon.ico",
"^/static/(.*)$" => "/static/$1",
"^/(.*)$" => "/code.py/$1",
)
This way it seems to work but, when I move on on the tutorial and start using templates it stops working (I receive the error: No template named index). I'm quite sure that the bin-path setting is wrong, but that's the only way I could make it run.
What's the correct way of handling this configuration?