App Engine allows developers to focus on doing what they do best, writing 
code. Based on Google Compute Engine, the App Engine flexible environment 
automatically scales your app up and down while balancing the load. 
Microservices, authorization, SQL and NoSQL databases, traffic splitting, 
logging, versioning, security scanning, and content delivery networks are 
all supported natively. In addition, the App Engine flexible environment 
allows you to customize the runtime and even the operating system of your 
virtual machine using Dockerfiles. You may find related information on the 
"App Engine Flexible Environment" documentation page 
<https://cloud.google.com/appengine/docs/flexible/>. 

The "cloud_sql_instances: INSTANCE_CONNECTION_NAME" instruction from 
app.yaml is meant for this Flexible managed environment. It is difficult to 
view it as hard coding. In what concerns Django, this is your framework of 
choice, and you are in a position to take the most advantageous decisions. 
Instead of hard coding, you could, for instance, make use of the already 
set environment variables: 

env_variables:
    # Replace user, password, database, and instance connection name with 
the values obtained
    # when configuring your Cloud SQL instance.
    SQLALCHEMY_DATABASE_URI: >-
      
mysql+pymysql://USER:PASSWORD@/DATABASE?unix_socket=/cloudsql/INSTANCE_CONNECTION_NAME
#[END gae_flex_mysql_env]

This allows you to reference environment variables in your Python code. For 
an example, you could follow the example on the "Using Cloud SQL for MySQL" 
documentation page 
<https://cloud.google.com/appengine/docs/flexible/python/using-cloud-sql>. 
 
# Environment variables are defined in app.yaml.
app.config['SQLALCHEMY_DATABASE_URI'] = 
os.environ['SQLALCHEMY_DATABASE_URI']
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

The above code excerpt illustrates how you may refer environment variables 
in your Python code. 

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/e2f0e611-2f87-478e-95f2-cf0f36931b87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine]... Neuron Teckid
    • [google-appen... 'George (Cloud Platform Support)' via Google App Engine

Reply via email to