On Sep 11, 3:24 pm, Chris <[EMAIL PROTECTED]> wrote:
> I have an application that uses some large packages, such as Wordnet,
> and the imports can take awhile. Is there a mechanism in Django to
> persist imported package across requests? I'm running Django viamod_wsgi, and
> it seems to re-import everything in my view files for
> *every* request, which makes the application unusably slow.
Be aware that Apache/mod_wsgi in embedded mode on UNIX is going to be
multiprocess. Thus where you think it is being loaded on every
request, it is more likely just the result of the various processes
loading the application the first time it is used. After they are all
loaded, you shouldn't see loading occurring.
Anyway this is it in simple terms, as it is actually more complicated
than that as Apache can kill off processes and replace them in certain
situations.
For some details of how processes are used in Apache/mod_wsgi see:
http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
To know what is definitively what is going on, following instructions
in:
http://code.google.com/p/modwsgi/wiki/DebuggingTechniques
and set:
LogLevel info
in Apache configuration, in place of default 'warn'. This should
result in mod_wsgi outputing a lot of information into main and per
virtual host, as appropriate, error logs about when processes are
being started/restarted and when WSGI application scripts being
loaded.
So do that and report on what you see, including examples of Apache
error logs which you believe shows the behaviour you are claiming.
Also, you should still post the configuration you use so we can
confirm it is correct. I have many times had people say they followed
the documentation, but in fact they had tweaked it slightly and
inadvertently caused problems for themselves.
Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---