2009/1/29 gert <[email protected]>:
>
> On Jan 28, 3:00 am, gert <[email protected]> wrote:
>> On Jan 28, 2:41 am, Graham Dumpleton <[email protected]>
>> > This is for two reasons. The first is that a wrong configuration of
>> > Apache will mean that people can download your source code, including
>> > database logins and passwords if kept in those files. Second is that
>> > if using .py extensions for WSGI script files and Python path being
>> > set to be directory where WSGI script files are located, you can
>> > double import WSGI script files under file name. The latter occurs
>> > because mod_wsgi doesn't use standard Python module importer and so
>> > using 'import' for name of WSGI script file will import it a second
>> > time.
>
> Ok so let say we have
> /usr/httpd/htdocs/wsgi/double.py
> WSGIPythonPath is set too /usr/httpd/htdocs/wsgi/
> document root /usr/httpd/htdocs/
> and apache is running embedded mode AddHandler wsgi-script .py
>
> Does it do a double import of double.py when opening browser with
> http://..../wsgi/double.py ?

We have had this discussion before some time back from memory. Last
time I pointed you at:

  http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

If you have two .py WSGI script files in that directory, eg. single.py
and double.py, and both were used as WSGI script files, and in
single.py it did 'import double', then you will end up with two copies
of double.py in memory.

That imported using 'import' from single.py will have __name__ set to
'double'. That loaded by mod_wsgi as WSGI script file will have
__name__ set differently and will be stored separately in sys.modules.

Thus, it isn't the act of sticking them in the directory, it is doing
a separate 'import' of the WSGI script file from another WSGI script
file or from some other Python module on sys.path.

Graham

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to