Re: Testing Python Mod

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris Howell wrote:
Brian Munroe wrote:
On 9/4/07, Chris Howell <chowell@xxxxxxxxxxxxxxxxxxx> wrote:
  

  
Brian:
I made the modifications you suggested my httpd conf file now has this
entry in it.

 LoadModule python_module modules/mod_python.so

 <Directory "C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs/Test">
    Order deny,allow
    Satisfy all
    AddHandler mod_python .py
    PythonHandler mod_python.publisher
    PythonDebug On
 </Directory>

 My test.py file looks like.

     def world(req):
        return "Hello World"

 When I try to access it like
 http://localhost:9000/Test/test.py/world

 I get a 404.

 Any other ideas ?

    

At least you are getting a new kind of error!

Well, it isn't exactly like I suggested, but I tried your
configuration (you have a 'Listen 9000' in your httpd.conf, right?)
and everything worked fine for me.

I know this is a pain, but comment out the <Directory> </Directory>
related to the mod_python stuff, restart apache and see if you still
get the 404 when trying to hit

http://localhost:9000/Test/test.py

You should get the raw python code rendered in your browser.

-- brian

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
  

Brian:

Yes I have set it up to listen on port 9000 and everything works fine. I fixed the 404 error. This is the error I am getting now.

MOD_PYTHON ERROR

ProcessId:      2932
Interpreter:    '192.168.0.42'

ServerName:     '192.168.0.42'
DocumentRoot:   'C:/Program Files/Apache Software Foundation/Apache2.2/htdocs'

URI:            '/Test/test.py'
Location:       None
Directory:      'C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/Test/'
Filename:       'C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\Test\\test.py'
PathInfo:       ''

Phase:          'PythonHandler'
Handler:        'mod_python.publisher'

Traceback (most recent call last):

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line 1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line 1128, in _execute_target
    result = object(arg)

  File "C:\Python25\Lib\site-packages\mod_python\publisher.py", line 204, in handler
    module = page_cache[req]

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line 1059, in __getitem__
    return import_module(req.filename)

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line 296, in import_module
    log, import_path)

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line 680, in import_module
    execfile(file, module.__dict__)

  File "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Test\test.py", line 1

    def world(req):

   ^

IndentationError: unexpected indent


MODULE CACHE DETAILS

Accessed:       Tue Sep 04 11:28:20 2007
Generation:     1

_mp_55aa27656fb6b0a34cdceffae0e6fbab {
  FileName:     'C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\Test\\test.py'
  Instance:     4 [RELOAD]
  Generation:   1 [ERROR]
  Modified:     Tue Sep 04 11:25:29 2007
  Imported:     Tue Sep 04 11:24:38 2007
}

I suspect it's related to the format of my .py file, so I am in the process of addressing it at that avenue right now. 
  

Cheers
Chris
  


No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.485 / Virus Database: 269.13.3/986 - Release Date: 9/3/2007 9:31 AM
Brian:

Finally got it working thanks so MUCH for your help.

Cheers
Chris Howell
Software Engineer
chowell@xxxxxxxxxxxxxxxxxxx
the PYXIS innovation - Common Ground for Digital Earth
Kingston, Ontario
w: www.pyxisinnovation.com



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux