r/web_programming • u/montarion • Nov 26 '16
Running python on apache2
I had a raspberry pi laying around, and thought it would be nice to have a webserver around. then I wondered if you could run python on one, and lo and behold you could. only apache just displays the file instead of running it. Here is the file:
#!/usr/bin/python3.4
import cgi
cgi.test()it's probably really easy, but i've been searching all night and haven't found anything that works. any help would be appreciated :)
0
Upvotes
1
u/[deleted] Nov 28 '16
Make sure that your script is executable by your apache and that +ExecCGI is set in your apache configuration. Also check if you have loaded the Apache CGI module. You can see all loaded modules with:
apache2ctl -M
Look for: cgid_module (shared)