Lorenzo
Lorenzo

Reputation: 89

Specify settings file for Django deployment at GCP App Engine

Inside my Django project, my main app (where the settings.py file is located) is called "main/".

But, I have deleted the settings.py file, now I have a directory called "settings/", and inside it, I have different configuration files, e.g., development.py, production.py, etc.

How to specify which file Google Cloud Platform should use for my App Engine deployment?

Thank you.

Upvotes: 0

Views: 177

Answers (1)

Lorenzo
Lorenzo

Reputation: 89

I was able to figure this out. Use env_variables tag.

app.yaml

# [START django_app]
runtime: python37

handlers:
# This configures Google App Engine to serve the files in the app's static
# directory.
- url: /static
  static_dir: static/

# This handler routes all requests not caught above to your main app. It is
# required when static routes are defined, but can be omitted (along with
# the entire handlers section) when there are no static files defined.
- url: /.*
  script: auto

# Specify settings file
env_variables:
  DJANGO_SETTINGS_MODULE: "main.settings.gcloud"
# [END django_app]

Upvotes: 2

Related Questions