You will have to at least provide the source to the wsgi script file.
For instance, the WSGIScriptAlias would have to be home.py, not
home.pyo. The extension in this case does not change the behavior of
mod_wsgi, in fact, most examples I have seen using the .wsgi extension
for the WSGIScriptAlias file (home.wsgi) even though it contains
python code. You can then import the rest of your code from the
bootstrap, and only provide the .pyc/pyo files for the imported
modules. So, if the code you wish to hide is in the wsgi script
(home.py) move it elsewhere and import it.
FWIW, a .wsgi extension is used because although it contains Python
code, it doesn't follow the normal conventions for module naming and
relative module importing.
So,if you look as __name__ of module it isn't basename of code file
but a magic calculated string. This is necessary to allow same code
file name to be used in multiple path locations mapped to with
different URLs from Apache. If used basename of code file, they would
all clash with each other.
Further, if use .py extension, someone could import the WSGI script
file by basename and that would cause a duplicate because in that case
would use basename. That would cause problems if accessing global data
in it, as wouldn't be the same data.
For module importing, an import from in the code file doesn't look in
current directory like with normal modules or packages and if you
wanted to that you would need to setup Python module search path your
self. Do that though and you do open yourself up to multiple import
problem above if use .py extension.
That therefore is the rational for suggesting .wsgi extension of .py.
Graham
> --
> You received this message because you are subscribed to the Google Groups "modwsgi" group.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to modwsgi+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
>
>
Very informative. Thank you Graham.