i believe it is request.env.http_host will give you the domain name that was used to access the site.
the appspot domain will never go away, and it will take some time to train the google index to prefer your custom domain. note that in your DNS you can redirect your naked domain to www so that you don't end up at appspot. cfh