Hi!

I am trying to run ogcserver(mapnik2) through mod_wsgi.

First I tried using stand alone wsgi whick worked fine. But using
mod_wsgi I get the following error:

[Tue Nov 08 21:12:04 2011] [error] [client 148.122.14.34] mod_wsgi
(pid=1640): Target WSGI script '/var/www/wsgi/test.py' cannot be
loaded as Python module.
[Tue Nov 08 21:12:04 2011] [error] [client 148.122.14.34] mod_wsgi
(pid=1640): Exception occurred processing WSGI script
'/var/www/wsgi/test.py'.
[Tue Nov 08 21:12:04 2011] [error] [client 148.122.14.34] Traceback
(most recent call last):
[Tue Nov 08 21:12:04 2011] [error] [client 148.122.14.34]   File
"/var/www/wsgi/test.py", line 7, in <module>
[Tue Nov 08 21:12:04 2011] [error] [client 148.122.14.34]
application = WSGIApp('/var/www/wsgi/ogcserver.conf')
[Tue Nov 08 21:12:04 2011] [error] [client 148.122.14.34]   File
"/usr/lib/pymodules/python2.7/mapnik2/ogcserver/wsgi.py", line 42, in
__init__
[Tue Nov 08 21:12:04 2011] [error] [client 148.122.14.34]     raise
ServerConfigurationError('The factory module could not be loaded.')
[Tue Nov 08 21:12:04 2011] [error] [client 148.122.14.34]
ServerConfigurationError: The factory module could not be loaded.




So I am guessing it does not find my mapfactory.py file. However I
have included that specifically in my wsgi script:

#!/usr/bin/env python

import sys
from mapnik2.ogcserver.wsgi import WSGIApp
sys.path.append('/var/www/wsgi/mapfactory.py')

application = WSGIApp('/var/www/wsgi/ogcserver.conf')
## Removed since running mod_wsgi ##
#if __name__ == '__main__':
#    from wsgiref.simple_server import make_server
#    httpd = make_server('localhost', 8080, application)
#    print "Listening on port 8080...."
#    httpd.serve_forever()




My reference to the mapfactory in ocgserver.conf file is defined like this:
module=/var/www/wsgi/mapfactory




And the mapfactory.py file is like this:
import os
from ogcserver.WMS import BaseWMSFactory
from mapnik2 import Style, Layer, Map, load_map

class WMSFactory(BaseWMSFactory):
    def __init__(self):
        BaseWMSFactory.__init__(self)
        base_path, tail = os.path.split(__file__)
        file_path = os.path.join(base_path, '/var/www/wsgi/kart.xml')
        self.loadXML(file_path)
        self.finalize()
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to