view raw
Satish Viswanathan Satish Viswanathan - 1 year ago 189
Python Question

Trouble running Flask in Apache/CGI

I have a shared hosting from Namecheap ( No ssh access). There I can run any python file in the CGI-bin directory when I type the full path including the .py extension. I want to know how to run a flask app in such an environment. Should I change the .htaccess or make a .cgi or fcgi or wsgi? I am not sure what these are or what they do. If someone can explain these too.


Check out

If your CGI-app is available at, you have to put the following in a .htaccess (assuming you're using Apache) to make the app available at

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f # Don't interfere with static files
RewriteRule ^(.*)$ /cgi-bin/$1 [L]