...
Step 4:
Navigate to the Apache folder. If the Apache web server is not installed in your machine yet, download the newest stable release of Apache (https://httpd.apache.org/download.cgi). After installation, in the Apache folder c:\Program Files (x86)\Apache Software Foundation\Apache2.2
you find a sub folder called cgi-bin
. Create an empty file called pywps.cgi
in this folder and insert the following code in it, after checking the python path (and correcting it: for example if you have Python2.7 installed, the first line should be #!c:\python27\python.exe
):
Code Block | ||
---|---|---|
| ||
#!C:\python\python.exe
import sys
sys.path.insert(0, r"C:\pywps")
import os
os.environ['PYWPS_CFG']='C:/pywps/pywps_processes/default.cfg'
os.environ['MPLCONFIGDIR']='C:/Python27/Lib/site-packages/matplotlib/mpl-data'
# Note that WPS runs as apache user and not as you, so many more user variables might be needed.
# Restart Apache after adding one.
import wps
|
...
Code Block | ||
---|---|---|
| ||
<ExceptionReport xmlns="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd">
<Exception exceptionCode="NoApplicableCode">
<ExceptionText>'No query string found.'</ExceptionText>
</Exception>
</ExceptionReport>
|
Step 7:
Now pywps runs, test for correct WPS behaviour in browser using the syntax in WPS primerPrimer. In c:\pywps\tests\processes
some example processes are included, copy its entire contents to the c:\pywps\pywps_processes
folder (that you configured as processesPath=c:/pywps/pywps_processes
in c:\pywps\pywps_processes\default.cfg
) and find out whether you can get them to run. First test the GetCapabilities request:
Code Block | ||
---|---|---|
| ||
<wps:Capabilities service="WPS" version="1.0.0" xml:lang="en-CA" xsi:schemaLocation="http:/opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsGetCapabilities_response.xsd" updateSequence="1">
...
</wps:Capabilities>
|
...
Known installation issues:
If the GetCapabilities request gives you
getthis error
Code Block title http://localhost/cgi-bin/pywps.cgi?service=wps&request=GetCapabilities&version=1.0.0 Internal Server Error
in your html browser, please check your apache error.log in
c:\Program Files (x86)\Apache Software Foundation\Apache2.2\logs
. In some cases it might contain this error messageImportError: No module named magic\r
. In this case please manually install the python-magic package from https://github.com/ahupp/python-magic. For your convenience we included a windows distributable win32 Python2.7 version until the official binary is available at github. Restart apache afterwards (typeservices
in your windows start menu or click small apache icon in icon tray). If you still get errors (failed to find libmagic
in the aforementioned Apache error.log) install cygwin http://cygwin.com/install.html which contains the magic dll. Set the path where thecygmagic-1.dll
residesc:\Program Files (x86)\Cygwin\bin
in the windows $PATH environment variable so magic.py can find it (bear in mind that this should be the System Variables Path setting).- The following error
AttributeError: 'exceptions.ImportError' object has no attribute 'replace'\r
is caused by the fact that point 7 is not fully followed. So put some processes in your processes folder and try the GetCapabilities again. - If you run this in a Virtual windows machine (e.g. via VMWare), regular disk mappings might not work in WPS because WPS runs as another users (apache), please try references like
//vmware-host/Shared%20Folders/D/
instead of simplyD
. Errors like these for import statements in a WPS process, e.g.
import matplotlib
causesCode Block PyWPS [2014-03-19 14:58:23,112] WARNING: Could not import processes from 'pywps_processes': ImportError('No module named pwd',)
have to do with the fact that WPS runs under
apache
user, so add any required user environmental
variables toc:\Program Files (x86)\Apache Software Foundation\Apache2.2\cgi-bin\pywps.cgi
:Code Block title pywps.cgi os.environ['MPLCONFIGDIR']='C:/Python27/Lib/site-packages/matplotlib/mpl-data'
Notes:
- PyWPS can also be used with the Q-GIS WPS plugin by Dr. Horst Duester.
...