-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Tom,
adding to Julien's response you could also replace `request.loadParams()` with `request.loadParamsFromURL(env['QUERY_STRING'])`. As Julien said, key is that the environment variables are not set automatically. cu Stephan On 07/14/2016 05:19 PM, Julien-Samuel Lacroix wrote: > Hi Tom, > > When I run your script, I get the following response: > > This script can only be used to decode form results and > should be initiated as a CGI process via a httpd server. > > This answer does not contain any content-type that can be stripped wit h > msIO_getStdoutBufferBytes(). That's why it returns None. > > Before your OWSRequest call, you need to set the Environment variable > that MapServer needs. Otherwise they are passed in the env variable an d > not to MapServer. Code to add: > > > # List of all environment variable used by MapServer > mapserv_env = [ > 'CONTENT_LENGTH', 'CONTENT_TYPE', 'CURL_CA_BUNDLE', 'HTTP_COOKIE', > 'HTTP_HOST', 'HTTPS', 'HTTP_X_FORWARDED_HOST', 'HTTP_X_FORWARDED_PORT ', > 'HTTP_X_FORWARDED_PROTO', 'MS_DEBUGLEVEL', 'MS_ENCRYPTION_KEY', > 'MS_ERRORFILE', 'MS_MAPFILE', 'MS_MAPFILE_PATTERN', 'MS_MAP_NO_PATH', > 'MS_MAP_PATTERN', 'MS_MODE', 'MS_OPENLAYERS_JS_URL', 'MS_TEMPPATH', > 'MS_XMLMAPFILE_XSLT', 'PROJ_LIB', 'QUERY_STRING', 'REMOTE_ADDR', > 'REQUEST_METHOD', 'SCRIPT_NAME', 'SERVER_NAME', 'SERVER_PORT' > ] > for key in mapserv_env: > if key in env: > os.environ[key] = env[key] > else: > os.unsetenv(key) > request = mapscript.OWSRequest() > > > Best regards, > Julien > > On 16-07-13 12:55 PM, Kralidis, Tom (EC) wrote: >> Hi all: we are looking into updating our Python MapScript (CGI-based) >> wrappers >> to leverage WSGI, and are having integration issues as part of testin g. >> >> We are using 6.4.2 on Ubuntu 14.04. See example in [1] (against >> any mapfile is fine). Simple run with python ./mapscript-wsgi.py >> which makes >> the server available on localhost:8000 by default. >> >> Issues: >> >> - the value in >> https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297# file-mapscript-wsgi-py-L18 >> ends up being a Python None type for some reason when it should be a >> string of the content-type >> - issuing a, say, WMS 1.3.0 GetCapabilities request yields the >> venerable MapServer "This script can ...." default message, when I am >> expecting Capabilities XML >> >> Any ideas what I'm doing wrong here? >> >> ..Tom >> >> [1] https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33 297 >> _______________________________________________ >> mapserver-users mailing list >> [email protected] >> http://lists.osgeo.org/mailman/listinfo/mapserver-users >> > -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXh7ZVAAoJEKNQXeNWi+qtf9UP/1k7tdKlqkLm2wZ3449qcY5F f8c9OfudiF3UAcIM5+V6+MDMRYFBC4u55g7tsfXRp/iiL4IaDYL5S5xmCViGaEwK T3fcB+F1UsJ68q7QWRyrJwQW8CPXDACTnDppIGE4yspSxCQHubbrbDCNzvQhqlx2 7YcnqTTNghcPMM4AKg0etzH+9I73nYYzukiZe0ZGvI+g0caotEAdY/Xb5kb3GuzJ aWV4fgTJSgS/r0R6O1UP+I41jHEUrgqoT7qLNqdKOyv502YZ/EGwkclhnPQst2Bq 1jFeNqsfvju4D3Ob/EGl4GnQEfptYqh+KwRmxeB+tW8kzRdIVD1D9R0MlbM5NC4d JHY1/4fpeBcFjbA+MVIWr2tbV7gDV4Mht/4lUszDNCUt055vV47sd+NNXl78+Fk8 lrdqbqtxJzKW0mKAsr44jmn65iMrqm+ts06iHTLPfKFkHL7kxqDWk8wIy8Xq6rGE 5c5cbHQOj6bXqlgZGxxcLq3kZu/Tpg1VOnD+DorpnVLrR7JOnDV+JDSaU7YCfhzI yV2WYbEGuJCZKEH7bLY/8oQ3XKCiH8+0a+RRU1efLjzCquLSCYXAOUc6pCPNzlrY JCV8VT6Fmnp/+brrCxCMgse39LWK8x9RuxSbi8UocFhDnmtbDgojA7xrzt/onqBJ 6Fzq/t4Wnl3ifjK1vjlK =Gj2e -----END PGP SIGNATURE----- _______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
