On 6 February 2010 07:34, Diego H. <[email protected]> wrote:
> Hello group, I have a project in Python what i choose to use WSGI for
> handdling the server side of the code, and i got this problem, i
> cannot import any external code, the only way is putting a copy of the
> carpet inside the "/usr/lib/python",

When run under Apache using mod_wsgi, Python does not inherit any
setting for PYTHONPATH that you have in your user environment.

Thus, Python modules must be installed properly, or you need to modify
your WSGI script file so that any additional installation directories
where modules are installed are added to sys.path.

> but if i try to import a carpet
> no matter where is send me an error of not found here is my code of
> the "/etc/apache2/sites-aviable/defaul"t:
>
> <VirtualHost *:80>
>        ServerAdmin webmas...@localhost
>
>        DocumentRoot "/opt/www/"
>        <Directory />
>                Options FollowSymLinks
>                AllowOverride None
>        </Directory>
>
>        WSGIScriptAlias / /media/d5c3e94e-5ab2-462e-9a74-ff4a35271110/hidura/
> BMSGroup/BMSuite/Suite/BMSuite/Suite/Gate.py
>        WSGIScriptAlias /wsgi /media/d5c3e94e-5ab2-462e-9a74-ff4a35271110/
> hidura/BMSGroup/BMSuite/Suite/BMSuite/Suite/wsgi/$1.py

This looks wrong anyway. That is '$1' is wrong in the context of a
WSGIScriptAlias directive. Although it has meaning in
WSGIScriptAliasMatch directive, the need to use that directive is
rare, so if you were trying to use it, likely you were going about it
the wrong way.

>        <Directory /media/d5c3e94e-5ab2-462e-9a74-ff4a35271110/hidura/
> BMSGroup/BMSuite/Suite/BMSuite/Suite/>
>                Options ExecCGI

Not need if using WSGIScriptAlias.

>                DirectoryIndex Gate.py index.html wsgi/__init__.py

You can specify files in a subdirectory for DirectoryIndex as far as I
recall and using wsgi/__init__.py likely will not do what you think it
does anyway.

>                SetHandler wsgi-script

Not needed if using WSGIScriptAlias.

>                Order allow,deny
>                Allow from all
>        </Directory>

So, you are mixing WSGIScriptAlias with the AddHandler/SetHandler way
of configuring mod_wsgi. You should use one or the other and not both.

See:

  http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
  http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines

> Now checking the logs of Apache i saw, the mistake, the Apache is not
> running a Python Apps, sorry i want to know how call a Python App from
> the WSGI code?

Have you looked at os.system(). Just ensure you use absolute path
names to programs you want to run as PATH of your user is not
inherited by Apache user.

That or look at the popen2 or subprocess modules.

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