简体   繁体   中英

Google Cloud AppEngine and Django: how should I set the domain name for have it work?

I've deployed a Django project on Google Cloud standard AppEngine,

  • My Domain Name is registered in Google Domains which confirms that it already points to my project when I try to customize my domains.
  • On the Web, I've access my project under its project name: https://mooveup-9645.oa.r.appspot.com
  • However when I try https://my-domain.fr the web site cannot be accessed. My Question is: Where should I add my domain name?
if APPENGINE_URL:
    # Ensure a scheme is present in the URL before it's processed.
    if not urlparse(APPENGINE_URL).scheme:
        APPENGINE_URL = f"https://{APPENGINE_URL}"

    ALLOWED_HOSTS = [urlparse(APPENGINE_URL).netloc, "www.my-domain.fr", "my-domain.fr"]

Is this the appropriate solution in Django settings or is there another configuration step with GCP?

On Google Cloud tutorial to deploy an Django project on AppEngine, some steps are skipped.

  1. On Django Settings complete the ALLOWED_HOSTS with your domain name.
  2. If you have a Standard AppEngine in order to avoid the overload of the Engine, the better is to deploy and then delete the former versions, in order to alleviate the risk of Error 502 :
$ gcloud app deploy --project PROJECT_ID --promote
$ gcloud app versions list --project PROJECT_ID  //to get the older versions
$ gcloud app versions delete VERSION_ID

Then:
On https://console.cloud.google.com/appengine/settings , you should customize your domain name and end your domain name with a DOT in order to get the DNS records and then update them on https://domains.google.com/registrar/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM