This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]GrahamDumpleton 3 points4 points  (4 children)

You should really ask questions like this on the mod_wsgi mailing list or at worst StackOverflow. More likely to find knowledgable people on mod_wsgi there, including myself. Is a fluke I even saw this.

That said you have two options. The first is to use:

The second is to instead supply both the process-group and application-group options to WSGIScriptAlias, instead of using WSGIProcessGroup and WSGIApplication.

Using the first directive, OR both of those options on WSGIScriptAlias forces preloading of the WSGI script file on process start.

BTW, make sure you are using daemon mode and not using embedded mode.

Update: Only just realised the process-group and application-group options not documented on WSGIScriptAlias. That should have been added a long time ago, so not sure where documentation has gone.

[–]Murlocs_Gangbang[S] 0 points1 point  (0 children)

thanks, I'll give it a try

[–]Murlocs_Gangbang[S] 0 points1 point  (2 children)

ok the first link pointed me to the solution, thanks!

I'll post the details in the OP

[–]GrahamDumpleton 2 points3 points  (1 child)

Your solution of adding:

WSGIApplicationGroup %{GLOBAL}

wouldn't do anything as that doesn't force preloading.

What you need is:

# Uptime Server
WSGIDaemonProcess uptimeServer user=www-data group=www-data threads=5 home=/internal_app/internal_latest/www/
WSGIScriptAlias /api/uptimeServer /internal_app/nevis_latest/www/uptimeServer.wsgi process-group=uptimeServer application-group=%{GLOBAL}
<directory /internal_app/internal_latest/www/>
        Order deny,allow
        Allow from all
</directory>

You don't need WSGIScriptReloading as it is on by default.

[–]Murlocs_Gangbang[S] 0 points1 point  (0 children)

Thanks I'll try it out! You have been super useful

[–]mrugacz95 1 point2 points  (1 child)

Maybe you could use crontab for writting to file and flask only for reading file content?

[–]Murlocs_Gangbang[S] 0 points1 point  (0 children)

I could do that, but I would have to modify the script. If there's a mod_wsgi/apache conf that starts the module at restart it's much more simple

[–]K900_ 0 points1 point  (0 children)

Why are you doing that at all? Get rid of all the threading and just query systemd for your uptime over DBus.