NOTE. I found five questions related to broken implementations of "hello world on flask / mod_wsgi". I looked through all of them and cannot find a solution to my own broken implementation. Therefore, please do not rush to close this question as a duplicate.
I am running a cloud-based Ubuntu VM. He is currently launching the LAMP stack. In my webroot, I have media and several HTML files, such as http://pipad.org/ball/multiball.html - everything works fine.
Now I'm trying to use the http://pipad.org/foo page dynamically generated by the Python backend using Flask and Apache / mod_wsgi.
Unfortunately, going to my browser at http://pipad.org/foo causes the URL not to be found.
Here are my files:
pi@PiDroplet:~/web/piFlask$ pwd
/home/pi/web/piFlask
pi@PiDroplet:~/web/piFlask$ ls -l
total 24
-rw-r--r-- 1 root root 628 May 15 02:37 apache.conf
-rwxrwxr-x 1 pi pi 153 May 15 02:39 piFlask.py
-rwxrwxr-x 1 pi pi 379 May 15 02:38 piFlask.wsgi
drwxrwxr-x 5 pi pi 4096 May 14 09:06 venv
piFlask.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
piFlask.wsgi
import os, sys
PROJECT_DIR = '/home/pi/web/piFlask'
activate_this = os.path.join(PROJECT_DIR, 'bin', 'activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
sys.path.insert(0, PROJECT_DIR)
from piFlask import app as application
apache.conf
pi@PiDroplet:~/web/piFlask$ cat apache.conf
<VirtualHost *>
ServerName pipad.org
WSGIDaemonProcess piFlask user=pi group=pi threads=5
WSGIScriptAlias /foo /home/pi/web/piFlask/piFlask.wsgi
<Directory /home/pi/web/piFlask>
WSGIProcessGroup piFlask
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
And according to the comment in the above configuration file, ...
pi@PiDroplet:~/web/piFlask$ tail -n 2 /etc/apache2/apache2.conf
Include /home/pi/web/piFlask/apache.conf
Can anyone see what I am missing?