Last active
December 30, 2018 04:59
-
-
Save ryu22e/bb96135458242f20b9ad07222da172a4 to your computer and use it in GitHub Desktop.
Responder==1.0.1( http://python-responder.org/ )で作ったアプリをGAE/Python3.7で動かすサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
# Pipenv | |
Pipfile | |
Pipfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
runtime: python37 | |
entrypoint: uvicorn --host 0.0.0.0 --port $PORT main:api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<!-- このファイルはプロジェクト直下に作ったtemplatesディレクトリの下に置く --> | |
<meta charset="UTF-8"> | |
<title>Hello, World!</title> | |
<link href="/static/css/main.css" rel="stylesheet" type="text/css" media="all"> | |
</head> | |
<body> | |
<h1>Hello, World!</h1> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The MIT License (MIT) | |
Copyright (c) 2018 Tsutsui, Ryuji | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all | |
copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* このファイルはプロジェクト直下に作ったstatic/cssディレクトリの下に置く */ | |
body { | |
background: #eeeeee; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import responder | |
BASE_DIR = Path(__file__).parent | |
api = responder.API( | |
static_dir=str(BASE_DIR.joinpath('static')), | |
templates_dir=str(BASE_DIR.joinpath('templates')), | |
) | |
@api.route("/") | |
async def greet_world(req, resp): | |
resp.text = api.template('index.html') | |
if __name__ == '__main__': | |
api.run(port=8080) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-i https://pypi.org/simple | |
aiofiles==0.4.0 | |
aniso8601==3.0.2 | |
apispec==1.0.0b3 | |
apistar==0.6.0 | |
asgiref==2.3.2 | |
async-timeout==3.0.1 | |
certifi==2018.10.15 | |
chardet==3.0.4 | |
click==7.0 | |
docopt==0.6.2 | |
graphene==2.1.3 | |
graphql-core==2.1 | |
graphql-relay==0.4.5 | |
graphql-server-core==1.1.1 | |
h11==0.8.1 | |
httptools==0.0.11 | |
idna==2.7 | |
itsdangerous==1.1.0 | |
jinja2==2.10 | |
markupsafe==1.0 | |
marshmallow==3.0.0b19 | |
parse==1.9.0 | |
promise==2.2.1 | |
python-multipart==0.0.5 | |
pyyaml==4.2b4 | |
requests-toolbelt==0.8.0 | |
requests==2.20.0 | |
responder==1.0.1 | |
rfc3986==1.1.0 | |
rx==1.6.1 | |
six==1.11.0 | |
starlette==0.5.5 | |
urllib3==1.24 | |
uvicorn==0.3.16 | |
uvloop==0.11.2 ; sys_platform != 'win32' | |
websockets==6.0 | |
whitenoise==4.1 |
Hi ...
Are you saying that you reach to run an ASGI app on the Google AppEngine python37 STANDARD ENV (2nd generation) ?
Is your responder working on an appspot instance ???
This Gist made my responder deploy to Google App Engine easily. thx.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
デプロイはGoogle Cloud SDKをインストールした環境で
gcloud app deploy
を実行。Pipenvを使いたいならプロジェクト直下に以下の内容の
Pipfile
を置いて、pipenv install && pipenv lock -r > requirements.txt
を実行する。