I have installed lighttpd on the Pi, and configured it to run web.py using fastcgi. Accessing python scripts from the browser works. But when I add the code to access GPIO, it fails with the following:
RuntimeError: No access to /dev/mem. Try running as root! Traceback (most recent call last): File "/var/www/index.py", line 134, in GPIO.setup(17, GPIO.OUT);#enable A RuntimeError: No access to /dev/mem. Try running as root!
I have added lighttpd to the sudoers file using the visudo command. But still, it won't work. Any suggestions?
Here is my lighttpd config file:
> server.modules = (
> "mod_access",
> "mod_alias",
> "mod_compress",
> "mod_accesslog", )
>
> server.document-root = "/var/www" server.upload-dirs =
> ( "/var/cache/lighttpd/uploads" ) server.errorlog =
> "/var/log/lighttpd/error.log" server.pid-file =
> "/var/run/lighttpd.pid" server.username = "www-data"
> server.groupname = "www-data"
>
>
> ## Use ipv6 if available
> #include_shell "/usr/share/lighttpd/use-ipv6.pl"
>
>
> compress.cache-dir = "/var/cache/lighttpd/compress/"
> compress.filetype = ( "application/x-javascript",
> "text/css", "text/html", "text/plain" )
>
> include_shell "/usr/share/lighttpd/create-mime.assign.pl"
> include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
>
> server.modules += ( "mod_fastcgi" ) server.modules += (
> "mod_rewrite" )
>
> fastcgi.server = ( "/index.py" => ("/" => ( "socket" =>
> "/tmp/fastcgi.socket",
> "bin-path" => "/var/www/index.py",
> "max-procs" => 1, "bin-environment" => (
> "REAL_SCRIPT_NAME" => "" ), "check-local" => "disable" )) )
>
> url.rewrite-once = ( "^/favicon.ico$" => "/static/favicon.ico",
> "^/static/(.*)$" => "/static/$1", "^/(.*)$" => "/index.py/$1", )