2
votes

I am running a flask application with apache using mod_wsgi. I was having trouble reloading the application after making a change to the python code so I read through the mod_wsgi wiki on reloading source code. I ran the script to confirm that I am running in Daemon mode, and my .conf VirtualHost is setup as follows:

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName dev.succor.co
    DocumentRoot /var/www/study_buddy_dev/study_buddy

    WSGIScriptAlias / /var/www/study_buddy_dev/study_buddy/app.wsgi

    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel info
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /var/www/study_buddy_dev/study_buddy/>
        AuthType Basic
        AuthName "Authentication Required"
        AuthUserFile "/etc/htpasswd/.htpasswd"
        Require valid-user

        WSGIScriptReloading On
        Order deny,allow
        Allow from all
    </Directory>

    WSGIDaemonProcess succor.dev processes=2 threads=15 display-name=%{GROUP}
    WSGIProcessGroup succor.dev
</VirtualHost>

But when I run ~$ sudo touch app.wsgi nothing changes in my application and I am completely at a loss as to why. Can anyone shed some light on what I am doing wrong here?

1
The reloading does not happen when you issue the touch, it happens when a request is received after. Have you tried sending a request after touching the script?Miguel
I try accessing the app in a browser and nothing has changed since before I updated the code... Does that browser access count as a request?azrosen92
I guess it depends on the change that you made to the application. Do you see a difference if you restart Apache?Miguel
I don't see a change when j restart Apache. I've made changes to both the Python code and some html code and neither change propagates.azrosen92
Then clearly the problem is elsewhere right? Restarting Apache kills and restarts all processes. If that isn't giving you an updated app, then it seems to me your configuration points to a stale version of your app.Miguel

1 Answers

2
votes

We have resolved this question in the comments above, but for the benefit of others, here is the solution to this problem:

My guess is that the Python files that Apache is running are not the Python files that you are editing, you probably have two sets of files installed. But this is only a guess, one that explains the behavior you are seeing,