1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#!/bin/sh
set -e
cat > /etc/apache2/conf-enabled/wsgi-embedded-py3.conf <<EOT
WSGIScriptAlias /wsgi-embedded-py3/ /var/www/hello.wsgi
EOT
cat > /var/www/hello.wsgi <<EOT
def application(environ, start_response):
status = '200 OK'
output = b'Hello World'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
EOT
chown www-data:www-data /var/www/hello.wsgi
a2enmod wsgi
service apache2 reload
if ! output=`wget -O- http://localhost/wsgi-embedded-py3/ 2>/dev/null`; then
echo "wget failed, output was:"
echo "$output"
echo
echo "Retest:"
wget -O- http://localhost/wsgi-embedded-py3/
exit 1
else
if [ "$output" != "Hello World" ]; then
echo "output is wrong"
echo "got: | $output |"
echo "expected: | Hello World |"
exit 1
fi
fi
|