I'm getting a 403: Forbidden error when trying to deploy a test Flask app on GoDaddy. I've installed Python 3.5.7, and the files I've added/changed are:
1) created .htaccess in public_html:
Options +ExecCGI
AddHandler cgi-script .py
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule /home/myusername/public_html/python/cgi-bin/app.cgi/$1 [L]
2) created a virtual environment venv in cgi-bin and installed Flask
3) created app.cgi in public_html/cgi-bin:
#!/home/myusername/.local/bin/python3
import os
import sys
sys.path.insert(0, '/home/myusername/public_html/cgi-bin/venv/lib/python3.5/site-packages')
from wsgiref.handlers import CGIHandler
activate_this = '/home/myusername/public_html/cgi_bin/venv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
from app import app
class ProxyFix(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
environ['SERVER_NAME'] = ""
environ['SERVER_PORT'] = "80"
environ['REQUEST_METHOD'] = "GET"
environ['SCRIPT_NAME'] = ""
environ['QUERY_STRING'] = ""
environ['SERVER_PROTOCOL'] = "HTTP/1.1"
return self.app(environ, start_response)
if __name__ == '__main__':
app.wsgi_app = ProxyFix(app.wsgi_app)
CGIHandler().run(app)
app.wsgi_app = ProxyFix(app.wsgi_app)
CGIHandler.run(app)
4) created app.py in public_html/cgi-bin:
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
return render_template('home.html')
if __name__ == '__main__':
app.run()
5) created home.html in public_html/cgi-bin/templates
I've also modified the permissions to 755 for these various files.
Does anyone have any suggestions for where I might be going wrong? Thanks so much for any guidance.