Satish Viswanathan Satish Viswanathan - 2 years ago 272
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.

Answer Source

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]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download