3

I know that the google app engine come with the self.request for url and the path in the python platform.

What I wanted to know is that did it come with anything to return only the domain name?

This is because sometime in the localhost, mywebapps.appspot.com and www.mywebapps.com will have different kind of behavior.

Or is there any python code I can referring to?

2 Answers 2

2

Google app engine uses the CGI standard, you can use Host header in request from within the application code and respond accordingly.

How to access Host will depend on the web framework e.g webapp and django may differ in details, but as it is CGI you can just access os.environ from anywhere e.g.

import os
logging.debug("Host: %s"%os.environ['HTTP_HOST'])
1

A little late to answer bu it's in the doc but quite hard to find A request class is from webop framework one has to follow the only link provided in App Engine doc http://pythonpaste.org/webob/reference.html

so the anser is self.request.host_url you'll need to remove the beginning http://

Not the answer you're looking for? Browse other questions tagged or ask your own question.