I'm having problems with deploying a Flask application to an Apache server with FastCGI (Uberspace). My basic hello world app is working. I set a variable for the index view. But chances on the variable won't update the view in the browser. Running the process with python geoflask.fcgi will show an updated version (in the terminal) but with following warnings:
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Status: 200 OK
I am using a virtualenv and my files looks like this:
my fcgi-bin/geoflask.fcgi:
#!/home/usr/.virtualenvs/flaskenv/bin/python2.7
RELATIVE_WEB_URL_PATH = '/geoflask'
import os
LOCAL_APPLICATION_PATH = os.path.expanduser('~') + '/html/geoflask'
import sys
sys.path.insert(0, LOCAL_APPLICATION_PATH)
from flup.server.fcgi import WSGIServer
from app import app
class ScriptNamePatch(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
environ['SCRIPT_NAME'] = RELATIVE_WEB_URL_PATH
return self.app(environ, start_response)
app = ScriptNamePatch(app)
if __name__ == '__main__':
WSGIServer(app).run()
my .htacces:
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
<Files ~ (\.fcgi)>
SetHandler fcgid-script
Options +FollowSymLinks +ExecCGI
</Files>
</IfModule>
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /fcgi-bin/geoflask.fcgi/$1 [QSA,L]
</IfModule>
Any hints or suggestions? I am struggling with it the whole day ...