I recently set up Flask through FastCGI and some trouble, but did manage to get it working. From what I recall the naming of your fcgi script file is important. I had to name mine literally “dispatch.fcgi” or it wouldn’t work. I have everything sitting in a subdirectory, “stout”, on my domain.
Here’s my .htaccess file:
RewriteRule ^dispatch.fcgi/ - [L]
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L][/code]
And my dispatch.fcgi:
from flup.server.fcgi import WSGIServer
from web import app
if name == ‘main’:
The rest of the setup is a standard Flask app with two packages. The web package runs the pages. The app is defined in the init.py for the package:
[code]$ cat web/init.py
from flask import Flask
app = Flask(name)
As to your question for the app.route call, all of Flask’s routing is handled internally. FastCGI always calls the same script (dispatch.fcgi in my case), then internally Flask will call the appropriate view method in your app. Here’s an example from my views.py file for the home page:
Flask matches up the request URL “/” to the app.route() I have defined and then calls the home() method.