Hello GJ,

Here is a sample that we use to do *exactly* the same thing.  Each project
has it's own Python directory which is added to the global python path (for
that project).

See the WSGIApplicationGroup, WSGIDaemonProcess, and WSGIProcessGroup for
information about why this works the way it does.

*#Global Configuration*
LoadModule wsgi_module modules/mod_wsgi.so
WSGISocketPrefix run/wsgi
WSGIApplicationGroup %{GLOBAL}

*#Per Project Configuration*
WSGIDaemonProcess ExampleProject threads=4
python-path=/opt/ExampleProject/Python
<VirtualHost *>
   ServerName ExampleProject.com
   DocumentRoot /opt/ExampleProject/Web
   WSGIScriptAlias /User /opt/ExampleProject/app.wsgi
   WSGIScriptAlias /Home /opt/ExampleProject/app.wsgi
   WSGIProcessGroup ExampleProject
   LogLevel info
   ErrorLog /opt/ExampleProject/Log/apache-error.log
</VirtualHost>

Sincerely,
Jason Garber


On Fri, Jan 8, 2010 at 3:55 PM, GJ <[email protected]> wrote:

> Hello, I decided to move away from using CGI directly to using WSGI on
> my own web application platform.
>
> I have just started with WSGI and have tried to read through the
> configuration guides of mod_wsgi, but I have not found out how exactly
> I should configure it on my server to best suit my needs, so I hope I
> can get some better assistance here by asking.
>
> So on my server I have multiple different small Python-based web
> applications (all made by myself using a common Python web app
> platform I am making), each on their own directories. Most of them
> consist of more than one script file that are to be executed on HTTP
> request and share some parts between the scripts, so they try to
> import common files such as configurations. Since these files are part
> of the projects themselves, they should not be visible to other
> projects and therefore reside in the same location as the scripts
> themselves.
>
> Now the problem is that by default mod_wsgi does not let scripts
> import modules that reside on the same directory as the script itself
> but only from locations listed in sys.path. I read some previous
> discussions about this and there are workarounds such as appending the
> path of the current module to sys.path but as explained there are
> problems such as there could be modules named the exact same in
> different locations, as is the case with me.
>
> Reading the configuration directives there were some things that allow
> grouping of some scripts to work in the same process/thread, and let
> other groups executed in different context. However, it was not clear
> what directives I should use from the configuration to achieve what I
> want: to separate each project to be its own group for mod_wsgi and
> add the project's folder to path for that group.
>
> Currently as I am developing the projects and testing them I am using
> mod_wsgi in daemon mode with two processes and 5 threads each, but
> depending on how much usage there will be in future, I will naturally
> adjust them accordingly.
>
> --
> 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]<modwsgi%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.
>
>
>
>
--
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