Skip to content

Commit

Permalink
Adding the GCP deployment test to the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
jare4857 committed Apr 18, 2020
1 parent 2122a08 commit 04e6c48
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 0 deletions.
19 changes: 19 additions & 0 deletions GCP Deploy Test/.gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore

# Python pycache:
__pycache__/
# Ignored by the build system
/setup.cfg
13 changes: 13 additions & 0 deletions GCP Deploy Test/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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
28 changes: 28 additions & 0 deletions GCP Deploy Test/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import datetime

from flask import Flask, render_template

app = Flask(__name__)


@app.route('/')
def root():
# For the sake of example, use static information to inflate the template.
# This will be replaced with real information in later steps.
dummy_times = [datetime.datetime(2018, 1, 1, 10, 0, 0),
datetime.datetime(2018, 1, 2, 10, 30, 0),
datetime.datetime(2018, 1, 3, 11, 0, 0),
]

return render_template('index.html', times=dummy_times)


if __name__ == '__main__':
# This is used when running locally only. When deploying to Google App
# Engine, a webserver process such as Gunicorn will serve the app. This
# can be configured by adding an `entrypoint` to app.yaml.
# Flask's development server will automatically serve static files in
# the "static" directory. See:
# http://flask.pocoo.org/docs/1.0/quickstart/#static-files. Once deployed,
# App Engine itself will serve those files as configured in app.yaml.
app.run(host='127.0.0.1', port=8080, debug=True)
1 change: 1 addition & 0 deletions GCP Deploy Test/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flask==1.1.2
7 changes: 7 additions & 0 deletions GCP Deploy Test/static/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

window.addEventListener('load', function () {

console.log("Hello World!");

});
4 changes: 4 additions & 0 deletions GCP Deploy Test/static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
font-family: "helvetica", sans-serif;
text-align: center;
}
16 changes: 16 additions & 0 deletions GCP Deploy Test/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html>
<head>
<title>Datastore and Firebase Auth Example</title>
<script src="{{ url_for('static', filename='script.js') }}"></script>
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>

<h1>Datastore and Firebase Auth Example</h1>

<h2>Last 10 visits</h2>
{% for time in times %} <p>{{ time }}</p>
{% endfor %}
</body>
</html>

0 comments on commit 04e6c48

Please sign in to comment.