2010/1/14 mog <[email protected]>:
> Hi,
>
> I'd like to add my code to python's path variable so I can do import
> statements. From what I understand, in daemon mode I can tell mod_wsgi where
> my code is using the python-path option, a bit like this:
>
> WSGIDaemonProcess testtest.elasticmind.net processes=1 threads=5 \
> display-name=test python-path=/home
Add:
WSGIProcessGroup testtest.elasticmind.net
You haven't told mod_wsgi to run that application in that daemon process group.
Note that using 'processes=1' is not recommended unless you understand
the side affects of what it does. Just drop that option if only want
one process as that is what it defaults to. The subtle difference is
that whenever 'processes' option is used, even for one process, the
'wsgi.multiprocess' flag is set True in WSGI environment. This can
prevent WSGI debuggers from working as they need guarantee that not
multiprocess.
Also suggest you use 'display-name=%{GROUP}' rather than
'display-name=test'. Calling process 'test' may be too confusing and
make it harder to spot in 'ps' listing especially since 'test' is the
name of a common UNIX utility.
Graham
> WSGIApplicationGroup %{GLOBAL}
> WSGIScriptAlias / /home/webtest/webtest.wsgi
>
> All the code is world readable and my test directory structure looks like
> this:
>
> /home/webtest
> /home/webtest/__init__.py
> /home/webtest/mytest.py
> /home/webtest/webtest.wsgi
>
> __init__.py is empty and mytest.py & webtest.wsgi contain the following...
>
>
> --- mytest.py ---
> def hello_world(environ, start_response):
> status = '200 OK'
> output = 'Hello World!'
> response_headers = [('Content-type', 'text/plain'),
> ('Content-Length', str(len(output)))]
> start_response(status, response_headers)
> return [output]
>
>
> --- webtest.wsgi ---
> from webtest.mytest import hello_world
> application = hello_world()
>
>
> What from I understand (when I did this with mod_python), the presence of an
> __init__.py file should make the 'webtest' directory be treated as a module,
> so this should work; but unfortunately after trying several different
> things, I seem to still be getting an error like this:
>
> [error] Target WSGI script '/home/webtest/webtest.wsgi' cannot be loaded as
> Python module.
> [error] Exception occurred processing WSGI script
> '/home/webtest/webtest.wsgi'.
> [error] Traceback (most recent call last):
> [error] File "/home/webtest/webtest.wsgi", line 1, in <module>
> [error] from webtest.mytest import hello_world
> [error] ImportError: No module named webtest.mytest
>
>
> I must be doing something wrong, but I think my brain is beginning to turn
> into sludge from being ill and doing lots of coding/testing lately. It would
> be great to get this solved for peace of mind. If anyone could please point
> out where I'm going wrong, it would be greatly appreciated. Thank you in
> advance for your time and consideration.
>
> --
> 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.
>
>
>
>
--
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.