1

I have recently set up a small personal website that I host on a little machine at home. The machine is running Windows 7, Apache 2.4.12, Mod_WSGI 4.4.6, and Python 3.4.2. I noticed that if the site has not been accessed recently, it takes a long time to load (20 - 30 seconds). I believe part of the problem is that Apache is lazily loading WSGI when it is accessed. This Stack Overflow post suggests that I can have Apache force load WSGI at startup, but then shows an example for daemon mode, which is a Linux only thing(?).

I am not very familiar with the syntax required for the httpd.conf file, and every time I try adding a line such as

WSGIImportScript "c:/.../wsgi.py"

Apache will not start. Is WSGIImportScript supported on windows? Am I not linking to the correct thing?

I was also under the impression that I could set WSGILazyInitialization to Off, and accomplish the same thing, but I can't figure out the correct syntax for that either.

Along the same lines, but a little off topic, due to the small nature of my site, is there a way to have Apache store all of the static files in RAM (<60MB) for faster access?

Thanks!

swimpat16
  • 11
  • 1

1 Answers1

1

The WSGILazyInitialization is completely unrelated.

The WSGIImportScript is described in the documentation at:

But you are better off not using it. You can do the same by specifying both process-group and application-group arguments to WSGIScriptAlias. Have both defined and it will have a side effect or preloading the script file.

WSGIScriptAlias /some/url /some/path/wsgi.py process-group=%{GLOBAL} application-group=%{GLOBAL}

The bigger question is why is your Apache instance killing the process off handling the requests anyway. A normal Apache configuration would not kill off the process and it should stay in memory.

BTW, you can set the Apache LogLevel to info to cause mod_wsgi to log more information about when it is loading the script file etc.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134