Saturday 15 May 2010

python - WSGI script displays as text, how can I make it execute? -



python - WSGI script displays as text, how can I make it execute? -

i have followed instructions on flask site deploying using wsgi.

i know apache2 server has wsgi enabled

$ sudo apache2 -m loaded modules: core_module (static) ... wsgi_module (shared) syntax ok

but when go site address, shows contents of wsgi script. expected execute script instead.

for example, modwsgi wiki has several test scripts can run check config, when modify wsgi script contain 1 of these test scripts , point browser script, see source code in browser.

i see no errors in apache2 log files. doing wrong?

my apache2 config looks this

1 <virtualhost *> 2 servername example.com 3 4 wsgidaemonprocess appname user=www-data group=www-data threads=5 5 wsgiscriptalias /appname /var/www/appname/appname.wsgi 6 7 <directory /var/www/appname> 8 wsgiscriptreloading on 9 wsgiprocessgroup appname 10 wsgiapplicationgroup %{global} 11 order deny,allow 12 allow 13 </directory> 14 </virtualhost>

/var/www/appname/appname.wsgi looks this

import sys def application(environ, start_response): status = '200 ok' output = '' output += 'sys.version = %s\n' % repr(sys.version) output += 'sys.prefix = %s\n' % repr(sys.prefix) response_headers = [('content-type', 'text/plain'), ('content-length', str(len(output)))] start_response(status, response_headers) homecoming [output]

python flask apache2 wsgi

No comments:

Post a Comment