SELinux is definitely disabled. When I test the app locally, all works well. I also found where you made a suggestion <https://davidhamann.de/2017/08/05/running-flask-with-wsgi-on-macos/> to try mod_wsgi-express start-server, and that works fine, and the URL displays and the image upload works:
# mod_wsgi-express-3 setup-server upload_pictures.wsgi --port=8987 --user my --group mygroup Server URL : http://localhost:8987/ Server Root : /tmp/mod_wsgi-localhost:8987:0 Server Conf : /tmp/mod_wsgi-localhost:8987:0/httpd.conf Error Log File : /tmp/mod_wsgi-localhost:8987:0/error_log (warn) Rewrite Rules : /tmp/mod_wsgi-localhost:8987:0/rewrite.conf Environ Variables : /tmp/mod_wsgi-localhost:8987:0/envvars Control Script : /tmp/mod_wsgi-localhost:8987:0/apachectl Request Capacity : 5 (1 process * 5 threads) Request Timeout : 60 (seconds) Startup Timeout : 15 (seconds) Queue Backlog : 100 (connections) Queue Timeout : 45 (seconds) Server Capacity : 20 (event/worker), 20 (prefork) Server Backlog : 500 (connections) Locale Setting : en_US.UTF-8 /tmp/mod_wsgi-localhost:8987:0/apachectl start So perhaps my stanza in the httpd.conf is awry? On Tuesday, October 29, 2019 at 3:32:14 PM UTC-4, Graham Dumpleton wrote: > > Where are you defining the path to upload images to? It cannot be a > relative path, you need to calculate it as an absolute path. See: > > > https://modwsgi.readthedocs.io/en/develop/user-guides/application-issues.html#application-working-directory > > Only other thing off top of my head that could be is that have SELinux > enabled and it is blocking where you are writing to. > > It is hard to guess without see any error message, but looks like you > don't have Flask configured to log error messages and they get swallowed up. > > Graham > > On 30 Oct 2019, at 2:50 am, Robert Kudyba <[email protected] > <javascript:>> wrote: > > Running Apache/2.4.41 on Fedora 30 and > python3-mod_wsgi-4.6.4-3.fc30.x86_64. And doing a test with: mod_wsgi-express > start-server /var/www/flask/upload_pictures.wsgi --user myuser works > mostly fine just uses Python 2.7 and some warnings. Browsing the URL works > fine. The app just allows users to upload a picture. > > [Tue Oct 29 10:05:05.365111 2019] [mpm_event:notice] [pid 17160:tid > 140276832493888] AH00489: Apache/2.4.41 (Fedora) mod_wsgi/4.6.4 Python/2.7 > configured -- resuming normal operations > [Tue Oct 29 10:05:05.365167 2019] [core:notice] [pid 17160:tid > 140276832493888] AH00094: Command line: 'httpd (mod_wsgi-express) -f > /tmp/mod_wsgi-localhost:8000:16836/httpd.conf -D > MOD_WSGI_MPM_ENABLE_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_EVENT_MODULE -D > MOD_WSGI_MPM_EXISTS_WORKER_MODULE -D MOD_WSGI_MPM_EXISTS_PREFORK_MODULE -D > FOREGROUND' > [Tue Oct 29 10:05:05.809860 2019] [wsgi:error] [pid 17162:tid > 140276832493888] /usr/lib/python2.7/site-packages/nilearn/__init__.py:73: > DeprecationWarning: Python2 support is deprecated and will be removed in the > next release. Consider switching to Python 3.6 or 3.7. > [Tue Oct 29 10:05:05.809882 2019] [wsgi:error] [pid 17162:tid > 140276832493888] _python_deprecation_warnings() > [Tue Oct 29 10:05:38.461053 2019] [mpm_event:notice] [pid 17160:tid > 140276832493888] AH00491: caught SIGTERM, shutting down > [Tue Oct 29 10:05:41.124861 2019] [mpm_event:notice] [pid 17414:tid > 140153494917440] AH00489: Apache/2.4.41 (Fedora) mod_wsgi/4.6.4 Python/2.7 > configured -- resuming normal operations > [Tue Oct 29 10:05:41.124923 2019] [core:notice] [pid 17414:tid > 140153494917440] AH00094: Command line: 'httpd (mod_wsgi-express) -f > /tmp/mod_wsgi-localhost:8000:16836/httpd.conf -D > MOD_WSGI_MPM_ENABLE_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_EVENT_MODULE -D > MOD_WSGI_MPM_EXISTS_WORKER_MODULE -D MOD_WSGI_MPM_EXISTS_PREFORK_MODULE -D > FOREGROUND' > [Tue Oct 29 10:05:41.598057 2019] [wsgi:error] [pid 17417:tid > 140153494917440] /usr/lib/python2.7/site-packages/nilearn/__init__.py:73: > DeprecationWarning: Python2 support is deprecated and will be removed in the > next release. Consider switching to Python 3.6 or 3.7. > [Tue Oct 29 10:05:41.598077 2019] [wsgi:error] [pid 17417:tid > 140153494917440] _python_deprecation_warnings() > > Here is what is in the upload_pictures.wsgi file: > > #!/usr/local/bin/anaconda3/bin/python3 > import sys > import logging > logging.basicConfig(stream=sys.stderr) > > sys.path.insert(0, '/home/myhome/myuser/public_html') > > from upload_pictures2 import app as application > > application.root_path = '/home/myhome/myuser/public_html' > > And here is what's in the end of the httpd.conf file: > > <VirtualHost *:8000> > WSGIDaemonProcess upload_pictures2 user=apache group=apache threads=5 > WSGIScriptAlias / /var/www/flask/upload_pictures.wsgi > > <Directory /home/myhome/myuser/public_html> > WSGIProcessGroup upload_pictures2 > WSGIApplicationGroup %{GLOBAL} > WSGIScriptReloading On > Order deny,allow > Allow from all > </Directory> > </VirtualHost> > > I've looked at similar issues here > <https://serverfault.com/questions/967882/uploading-a-python-flask-app-to-an-existing-apache2-server-and-making-it-listen> > and here > <https://stackoverflow.com/questions/41966855/possible-to-run-a-flask-app-with-mod-wsgi-on-a-specific-port>, > > but those don't appear to be related to my issue. I don't see any errors in > the logs, and netstat -ln|grep 8000 does not show port 8000 in use. Do I > have a problem with the paths? > > Here are the only logs that printed: > > [Tue Oct 29 10:29:47.742916 2019] [wsgi:info] [pid 26598:tid 140684965835072] > mod_wsgi (pid=26598): Attach interpreter ''. > [Tue Oct 29 10:29:47.746480 2019] [wsgi:info] [pid 26598:tid 140684965835072] > mod_wsgi (pid=26598): Imported 'mod_wsgi'. > [Tue Oct 29 10:29:47.746798 2019] [wsgi:debug] [pid 26598:tid > 140684920149760] src/server > > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/modwsgi/cb069c88-5af3-44ac-9fa4-28586a231264%40googlegroups.com > > <https://groups.google.com/d/msgid/modwsgi/cb069c88-5af3-44ac-9fa4-28586a231264%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/5d2ebb75-aeb9-4c50-8462-60246aed3965%40googlegroups.com.
