Reputation: 1
I have a Python Flask app structured as from home/Application/demo directory
src > controller > ( views.py, templates > index.html )
views.wsgi
views.wsgi
import sys
sys.path.insert(0, 'Applications/demo/src/controller')
from views import app as application
views.py
from flask import Flask
app = Flask(__name__)
if __name__ == '__main__':
app.run(debug=True)
Inside /etc/apache2/sites-available , I created a conf file named mysite.conf with content -
<VirtualHost *:80>
WSGIDaemonProcess views
WSGIScriptAlias / /Applications/demo/views.wsgi
<Directory /Applications/demo/src/controller>
WSGIProcessGroup views
WSGIApplicationGroup %{GLOBAL}
Require all granted
</Directory>
</VirtualHost>
And ran these commands -
sudo a2dissite 000-default.conf
sudo a2ensite mysite.conf
sudo /etc/init.d/apache2 restart
When I restart apache and go to the page, I get
Forbidden
You don't have permission to access / on this server.
Upvotes: 0
Views: 380
Reputation: 58523
Should be:
<Directory /Applications/demo>
WSGIProcessGroup views
WSGIApplicationGroup %{GLOBAL}
Require all granted
</Directory>
That is, the directory where the WSGI script file referred to by WSGIScriptAlias
is, not where the modules that then imports are.
Upvotes: 1