Installation nightmare (local dev with win/apache/mod_wsgi/python)

Asked by John Harris on 2012-10-03

I am trying to develop some web services on my local machine. I have apache installed (via xampp) and mod_wsgi. I am using Python 2.7.3 with virtualenv. I do not have much experience setting stuff up for the web so am feeling my way through this process. I have changed httpd.conf to load mod_wsgi, and to support python files by adding .py to the options line. At the moment I have installed everything and have a dir structure:

Python: C:\Python27
Apache: C:\xampp\apache
Virtualenv: C:\users\JH\python_environments\main_env
Test service: C\xampp\htdocs\ladon\myservice

The test service contains handler.py and myservice.py.

handler.py:
----------------------------------------------------------------------
activate_this = 'C:\Users\JH\python_environments\main_env\Scripts\activate_this.py' # To account for the virtualenv
execfile(activate_this, dict(__file__=activate_this) # To account for the virtualenv

from ladon.server.wsgi import LadonWSGIApplication
from os.path import abspath,dirname

application = LadonWSGIApplication(
  ['myservice'],
  [dirname(abspath(__file__))],
  catalog_name='My Ladon webservice catalog',
  catalog_desc='This is the root of my cool webservice catalog')
----------------------------------------------------------------------

myservice.py:
----------------------------------------------------------------------
from ladon.ladonizer import ladonize

class Calculator(object):
  """
  This service does the math, and serves as example for new potential Ladon users.
  """
  @ladonize(int,int,rtype=int)
  def add(self,a,b):
    """
    Add two integers together and return the result

    @param a: 1st integer
    @param b: 2nd integer
    @rtype: The result of the addition
    """
    return a+b
----------------------------------------------------------------------

I have also added the following to my httpd.conf (the error log lines didn't work so I commented them out):
----------------------------------------------------------------------
<VirtualHost *:80>

        ServerName localhost
        ServerAdmin <email address hidden>

        WSGIScriptAlias /myservice/ /ladon/myservice/handler.py

        LogLevel warn

        #ErrorLog ${APACHE_LOG_DIR}/mysite.com_error.log
        #CustomLog ${APACHE_LOG_DIR}/mysite.com_access.log combined

</VirtualHost>
----------------------------------------------------------------------

When I visit http://localhost in my web browser it goes to the xampp page (great). When I visit http://localhost/myservice/ it gives me a 403 Forbidden page. The apache error log says:

"[Wed Oct 03 13:12:34 2012] [error] [client ::1] client denied by server configuration: C:/ladon"

Why is it trying to access C:/ladon?? Where is that even configured?

Anymore details or a more complete installation walkthrough would be greatly appreciated, as it looks like a great module, I just can't get it to work!!!

Thanks!

Question information

Language:
English Edit question
Status:
Answered
For:
ladon Edit question
Assignee:
No assignee Edit question
Last query:
2012-10-03
Last reply:
2012-10-17
oyzzo (oyzzoforfree) said : #1

hi John Harris,

This line is wrong:
WSGIScriptAlias /myservice/ /ladon/myservice/handler.py

if your handler.py file is at C:\xampp\htdocs\ladon\myservice\handler.py

this line should look like this:

WSGIScriptAlias /myservice C:\xampp\htdocs\ladon\myservice\handler.py

I have no idea on windows, but i know here you have to put the absolute path to the handler.py file on your system so maybe it doesn't work but it's something similar.

On linux it's also needed python-docutils, check it too.

Hope you get it to work, i had a hard time figuring out everything the first time like you, but it's worth the effort, now i'm more than happy with it.

Good luck!

oyzzo

Can you help with this problem?

Provide an answer of your own, or ask John Harris for more information if necessary.

To post a message you must log in.