Skip to content
This repository has been archived by the owner on Dec 7, 2017. It is now read-only.

How to use endpoints with flask and gae? #19

Closed
du2x opened this issue Dec 1, 2015 · 5 comments
Closed

How to use endpoints with flask and gae? #19

du2x opened this issue Dec 1, 2015 · 5 comments

Comments

@du2x
Copy link

du2x commented Dec 1, 2015

I missed the use of endpoints in this skeleton.
According to Google and Udacity course, the endpoints are a major functionally.

@du2x du2x closed this as completed Dec 1, 2015
@theacodes
Copy link
Contributor

Hi @du2x, I noticed you closed this. Did you get your question answered?

@du2x
Copy link
Author

du2x commented Dec 1, 2015

No. Actually, I closed it because I was not sure about putting here as a issue is appropriate.
But I found a repo that can help me: https://github.com/Eforcers/gae-flask-todo.
Furthermore, after seeing that repo, I see that maybe the use of endpoints with flask would be nicer as a new skelleton, since there is much code to add.

@theacodes
Copy link
Contributor

You can think of cloud endpoints as essentially a separate WSGI app that lives alongside your flask app. They can share common code, but the "web framework" part is different. It's like using Flask and Bottle side-by-side. It's possible, but a little tricky.

Your app.yaml would likely look something like this:

handlers:
# Endpoints handler.
- url: /_ah/spi/.*
  script: api.APPLICATION

# Flask handler
- url: /.*
  script: main.app

api.py would contain the normal endpoints stuff, and define APPLICATION like this:

APPLICATION = endpoints.api_server([HelloWorldApi])

main.py would just be a regular flask app that defines app:

app = Flask(__name__)

@du2x
Copy link
Author

du2x commented Dec 1, 2015

nice, it's pretty clear now.
thanks @jonparrott .

@theacodes
Copy link
Contributor

No problem, glad I could help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants