mirror of
https://github.com/wassname/Clover-Edition.git
synced 2026-09-09 11:13:26 +08:00
first commit
This commit is contained in:
@@ -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
|
||||
@@ -0,0 +1,44 @@
|
||||
# Copyright 2018 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# [START gae_python37_render_template]
|
||||
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)
|
||||
# [START gae_python37_render_template]
|
||||
@@ -0,0 +1,23 @@
|
||||
# Copyright 2015 Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import main
|
||||
|
||||
|
||||
def test_index():
|
||||
main.app.testing = True
|
||||
client = main.app.test_client()
|
||||
|
||||
r = client.get('/')
|
||||
assert r.status_code == 200
|
||||
@@ -0,0 +1 @@
|
||||
Flask==1.0.2
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright 2018, Google LLC
|
||||
* Licensed under the Apache License, Version 2.0 (the `License`);
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an `AS IS` BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// [START gae_python37_log]
|
||||
'use strict';
|
||||
|
||||
window.addEventListener('load', function () {
|
||||
|
||||
console.log("Hello World!");
|
||||
|
||||
});
|
||||
// [END gae_python37_log]
|
||||
@@ -0,0 +1,4 @@
|
||||
body {
|
||||
font-family: "helvetica", sans-serif;
|
||||
text-align: center;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user