I'm new to GCP, we had chosen sanic framework to make things run smoother. Sanic supports python 3.5+ so we are going with flexible environment on appengine.
Currently I'm trying to deploy "Sanic" Hello world (Get started) application to appengine. and stuck config. problem at
# This looks like a Python app. If so, please enter the command to run
the app in production (enter nothing if it's not a python app): :
I had looked into other Google Cloud Platform (Python docs samples) examples which are available on GitHub all were using gunicorn but sanic has builtin http server.
Can someone suggest app.yaml model for sanic on appengine. my current setup follows as
1. app.yaml
runtime: python
env: flex
threadsafe: true
runtime_config:
python_version: 3
handlers:
- url: .* # This regex directs all routes to main.app
script: main.app
2. main.py
#import logging
from sanic import Sanic
from sanic.response import json
app = Sanic()
@app.route("/")
async def test(request):
return json({"hello": "world"})
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000)
3. requirements.txt
httptools
sanic
ujson
uvloop
UPDATE.
added entrypoint: python main.py
to app.yaml fixed my deploy problem but appengine throughs error.
Error: Server Error
The server encountered a temporary error and could not complete your request. Please try again in 30 seconds.
Thanks in advance. and if you cant solve my problem don't down vote.