I have been having problems deploying flask apps to my remote server for the first time. I often go through some long, involved, doing whatever I can steps and eventually the app starts working. But this cannot go on.
So, here I have my conf file. I can add one app and the app works. Then I add the second app and the first one still works but the second one is returning a 404.
One problem is that I am not seeing where to see errors anywhere. I see a 404 in the access.log and nothing for that request in the error.log. Where might WSGI-specific errors be seen?
The first app works. You can see it at https://opencalaccess.org/cdcr/ and https://opencalaccess.org/test_wsgi works.
I know (or are pretty sure) that the flask application itself is ok. I can run:
$ ./.venv/bin/python -m flask run --host=0.0.0.0
* Serving Flask app 'data_brokers'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8080
* Running on http://50.116.13.181:8080
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 526-161-898
71.202.194.221 - - [28/Mar/2024 09:17:47] "GET /data_brokers/ HTTP/1.1" 200 -
So this works ok. I can get data and everything else, but:
# cat opencalaccess.org-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName opencalaccess.org
ServerAlias www.opencalaccess.org
ServerAdmin [email protected]
RewriteEngine On
DocumentRoot /var/www/opencalaccess_org
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel info
CustomLog ${APACHE_LOG_DIR}/opencalaccess_org_ssl/access.log combined
ErrorLog ${APACHE_LOG_DIR}/opencalaccess_org_ssl/error.log
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews ExecCGI
Require all granted
</Directory>
WSGIApplicationGroup %{GLOBAL}
# example, shows that WSGI is installed, working.
WSGIScriptAlias /test_wsgi /var/www/opencalaccess_org/test_script.py
WSGIDaemonProcess cdcr threads=2 user=ray python-home=/home/ray/cdcr_www/.venv home=/home/ray/cdcr_www/
WSGIScriptAlias /cdcr /home/ray/cdcr_www/cdcr.py
<Directory /home/ray/cdcr_www/>
WSGIProcessGroup cdcr
Require all granted
</Directory>
WSGIDaemonProcess data_brokers threads=2 user=ray python-home=/home/ray/data_brokers/.venv home=/home/ray/data_brokers
WSGIScriptAlias /data_brokers /home/ray/data_brokers/data_brokers.py
<Directory /home/ray/data_brokers/>
WSGIProcessGroup data_brokers
Require all granted
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/opencalaccess.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/opencalaccess.com/privkey.pem
</VirtualHost>
</IfModule>
But I see:
$ curl -I 'https://opencalaccess.org/cdcr/'
HTTP/2 200
date: Thu, 28 Mar 2024 17:34:02 GMT
content-type: text/html; charset=utf-8
vary: Accept-Encoding
$ curl -I 'https://opencalaccess.org/data_brokers/'
HTTP/2 404
date: Thu, 28 Mar 2024 17:34:11 GMT
content-type: text/html; charset=utf-8
And here I can check all of the directories and files referred to in the apps' definitions:
# ls -ld /home/ray/cdcr_www/.venv
drwxrwxr-x 5 ray ray 4096 Aug 26 2023 /home/ray/cdcr_www/.venv
#
# ls -ld /home/ray/data_brokers/.venv
drwxrwxr-x 5 ray ray 4096 Mar 27 19:55 /home/ray/data_brokers/.venv
#
# ls -ld /home/ray/cdcr_www/
drwxrwxr-x 6 ray ray 4096 Feb 7 17:29 /home/ray/cdcr_www/
#
# ls -ld /home/ray/data_brokers/
drwxrwxr-x 5 ray ray 4096 Mar 27 19:55 /home/ray/data_brokers/
#
# ls -l /home/ray/cdcr_www/cdcr.py
-rw-rw-r-- 1 ray ray 1745 Feb 7 17:29 /home/ray/cdcr_www/cdcr.py
#
# ls -l /home/ray/data_brokers/data_brokers.py
-rw-rw-r-- 1 ray ray 801 Mar 28 09:27 /home/ray/data_brokers/data_brokers.py
#
# ls -ld /home/ray/cdcr_www/
drwxrwxr-x 6 ray ray 4096 Feb 7 17:29 /home/ray/cdcr_www/
#
# ls -ld /home/ray/data_brokers/
drwxrwxr-x 5 ray ray 4096 Mar 27 19:55 /home/ray/data_brokers/
#
The definitions for the apps in the config file look pretty similar to me.
How can I see what else is wrong?