Python Flask: transition from Swagger YAML to Google App Engine?

I used the Swagger editor to create the REST API, and I requested the server code download for Python Flask. I am trying to deploy this on the Google Cloud Platform (I think the last name? Or is it still GAE?), But I need to fill in some spaces.

I know that Swagger code works because I deployed it locally without any problems. However, it uses a communication library instead of Flask.

Basically, I get lost in how I can include the app.yaml file for GCP and the correct entry points to the generated code. In addition, I know that the generated code declares its own application server, which I don’t think you need to do for GCP. Here is my current app.yaml

application: some-app-name
version: 1
runtime: python27
api_version: 1
threadsafe: yes
entrypoint: python app.py

libraries:
- name: connexion
  version: "latest"

And here is my app.py

import connexion

if __name__ == '__main__':
    app = connexion.App(__name__, specification_dir='./swagger/')
    app.add_api('swagger.yaml', arguments={'title': 'this is my API'})
    app.run(port=8080)

, , -

google.appengine.api.yaml_errors.EventError: the library "connexion" is not supported

, - , .png - , , . , - Swagger, GCP?

+5
1

, , , , app.yaml . , .

, :

  • entrypoint:
  • connexion , , ( libraries). ( ).
    • handlers

, - Flask App Engine

, app.yaml, :

  • env: flex runtime: python ( vm: true runtime: python27 )
  • / , libraries.
+5

Source: https://habr.com/ru/post/1657864/


All Articles