Solved the issue. I just had to reorganise my wsgi entry file like this :
import sys
path = '/var/www/mysite.fr/mysite'
if path not in sys.path:
    sys.path.insert(0, path)

from app import create_app
application = create_app()

with app.py located within the same directory as the wsgi entry file ; I 
also changed my virtual host conf to include the virtual env as per the 
documentation.

Thanks again.
Le mercredi 21 février 2024 à 11:47:52 UTC+1, Anthony Sanchez a écrit :

> Hi all,
>
> I am facing a small issue regarding the reload of my source code change 
> with mod_wsgi in embeded mode.
> I made some changes in my code source, but those changes are not taken 
> into account when I restart apache. I did the following with no result : 
>
>    - applied a minor change in the wsgi entry file ;
>    - restarted the apache server.
>
> But nothing happened. I checked apache logs and all I see is normal 
> activity. What am I missing ?
> My configurations below :
>
> *wsgi entry file :*
> import sys
> path = '/var/www/mysite.fr/.venv_vo2/lib/python3.11/sites-packages'
> if path not in sys.path:
>     sys.path.insert(0, path)
>
> from mysite import create_app
> application = create_app()
>
> -----------------------------------------------------------------------------------------------------------------------------
> *my virtualhost conf file :*
> <VirtualHost *:80>
>     ServerName mysite.fr
>     ServerAlias www.mysite.fr
>
>     DocumentRoot /var/www/mysite.fr/mysite/
>
>     WSGIScriptAlias / /var/www/mysite.fr/mysite/mysite.wsgi
>     WSGIScriptReloading On
>     WSGIApplicationGroup %{GLOBAL}
>     
>     <Directory /var/www/mysite.fr/mysite/>
>         <IfVersion < 2.4>
>             Order allow,deny
>             Allow from all
>         </IfVersion>
>         <IfVersion >= 2.4>
>             Require all granted
>         </IfVersion>
>     </Directory>
>
>     ErrorLog ${APACHE_LOG_DIR}/error.log
>     CustomLog ${APACHE_LOG_DIR}/access.log combined
> RewriteEngine on
> RewriteCond %{SERVER_NAME} =mysite.fr [OR]
> RewriteCond %{SERVER_NAME} =www.mysite.fr
> RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
> </VirtualHost>
>
>
> -----------------------------------------------------------------------------------------------------------
> *virtual host conf encrypted version :*
> <IfModule mod_ssl.c>
> <VirtualHost *:443>
>  [...]
>     DocumentRoot /var/www/mysite.fr/mysite/
>     
>     WSGIScriptAlias / /var/www/mysite.fr/mysite/mysite.wsgi
>     WSGIScriptReloading On
>
> [...]
> </VirtualHost>
> </IfModule>
>
> Many Thanks,
> Anthony
>

-- 
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 modwsgi+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/5e8b3ab2-50f7-46d3-b795-056fbd35b4efn%40googlegroups.com.

Reply via email to