You don't need to specify absolute paths in the python script when you are
using mod_wsgi. Just check if mod_wsgi is loading the same version of
Python as the default python webserver. That might be the issue.


On Wed, Mar 13, 2013 at 8:29 AM, smego <[email protected]> wrote:

> Dear all,
> When run from apache, the import doesn't work by complaining:
>    3345 [Wed Mar 13 10:06:33 2013] [error] [client 221.130.253.135]
> mod_wsgi (pid=4389): Target WSGI script '/data1/code.py' cannot be loaded
> as Python module.
>    3346 [Wed Mar 13 10:06:33 2013] [error] [client 221.130.253.135]
> mod_wsgi (pid=4389): Exception occurred processing WSGI script
> '/data1/code.py'.
>    3347 [Wed Mar 13 10:06:33 2013] [error] [client 221.130.253.135]
> Traceback (most recent call last):
>    3348 [Wed Mar 13 10:06:33 2013] [error] [client 221.130.253.135]   File
> "/data1/code.py", line 3, in <module>
>    3349 [Wed Mar 13 10:06:33 2013] [error] [client 221.130.253.135]
> from config.url import urls
>    3350 [Wed Mar 13 10:06:33 2013] [error] [client 221.130.253.135]
> ImportError: No module named config.url
> When run from web.py server, it works ok.
> And I resolve that from a online tip:
> If you get an "ImportError: No module named web" in your apache error.log
> file, you could try setting the absolute path in code.py before importing
> web:
> import sys, os
> abspath = os.path.dirname(__file__)
> sys.path.append(abspath)
> os.chdir(abspath)
> import web
>
> Question is, Why that is happening? Is that a must for apache applications
> or can be set in some place as default setting?
> Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/webpy?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to