Я пытаюсь выполнить скрипт в python как скрипт cgi с помощью apache2. Однако вместо выполнения, файл загружается. Я разрешил свой файл python быть исполняемым. Я думаю, что это происходит, потому что моя строка shebang неверна. Итак, как я узнаю, какова правильная строка shebang для добавления. У меня установлен Ubuntu 16.04 и установлен python 3.5.2. Любая помощь / направление окажут большую помощь. Спасибо
EDIT
Добавление скрипта python
#!/usr/bin/env python
import cgi
form = cgi.FieldStorage()
query = form.getvalue('query')
print("Content-type:text/html")
print()
print("<html>")
print("<head>")
print("<title>search results</title>")
print("</head>")
print("<body>")
print("\
<div style = 'position:absolute;text-align:center;width:100%;left:0%;top:0%;margin:0%;padding:0%;'>\
<h4 style = 'font-family:Arial;font-size:24px;color:dodgerblue;'>muGoogle</h4>\
<form class='form-wrapper' action='hello.py' method='get'>\
<input type='text' id='search' placeholder='Search docs related to...' required name = 'query' style = 'font-family:Arial;font-\size:14px;width:60%;height:40px;'/>\
<input type='submit' value='Submit' id='submit' style = 'height:40px'>")
print("<p> search results for: %s </p>" % query)
print("</body>")
print("</html>")
EDIT
Добавление html
<html>
<head>
<title>muGoogle</title>
<link type = 'stylesheet' ref = 'style.css'>
</head>
<body>
<div style = 'position:absolute;text-align:center;width:100%;left:0%;top:15%;margin:0%;padding:0%;'>
<h4 style = 'font-family:Arial;font-size:48px;color:dodgerblue;'>muGoogle</h4>
<form class='form-wrapper' action='query.py' method='get'>
<input type='text' id='search' placeholder='Search docs related to...' required name = 'query' style = 'font-family:Arial;font-size:14px;width:60%;height:40px;'/>
<input type='submit' value='Submit' id='submit' style = 'height:40px'>
</form>
</div>
</body>
</html>
EDIT 3
добавление файла конфигурации по умолчанию
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks MultiViews
AllowOverride None
</Directory>
<Directory /var/www/>
Options ExecCGI Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
AddHandler cgi-script .py
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin/">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet