Standalone Python / google engine request

I know that google google engine comes with self.request for url and path on python platform.

What I wanted to know was that he came with anything to return only the domain name?

This is due to the fact that sometime in localhost , mywebapps.appspot.com and www.mywebapps.com will behave differently.

Or is there any python code I can reference?

+3
source share
2 answers

The mechanism for using Google uses the CGI standard , you can use the header Hostin the request from the application code and respond accordingly.

-, , webapp django , CGI, os.environ , .

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

, - webop , App Engine doc http://pythonpaste.org/webob/reference.html

anser - self.request.host_url http://

+1

Source: https://habr.com/ru/post/1750885/


All Articles