Python 3.7 Local Development Server Options for new app engine apps

前端 未结 2 405
时光说笑
时光说笑 2020-12-02 00:24

I have an app-engine app that is deployed and running on the standard Python3 runtime. I am also able to run it locally using normal commands like flask run. Bu

2条回答
  •  青春惊慌失措
    2020-12-02 00:51

    The dev_appserver.py support for Python 3 is still limited. From Running the local development server:

    Note:

    • Running dev_appserver requires the presence of Python 2.7.12+ on your local machine.
    • The updated dev_appserver does not support development of Python 3 apps on Windows.

    Which might be why it is not the recommended solution for local development (or at least not yet). From Running locally:

    We do not recommend that you depend on tools like dev_appserver, the local development server provided with the Google Cloud SDK. However, if you are migrating an existing App Engine application from Python 2 to Python 3, we have updated dev_appserver to facilitate this process. For all other local development scenarios, we recommend standard Python testing approaches.

    For example, you can usually run a Flask application with Flask's development server using:

    python main.py
    

    Django applications can be started using:

    python manage.py runserver
    

    To simulate a production App Engine environment, you can run the full Web Server Gateway Interface (WSGI) server locally. To do this, use the same command specified as entrypoint in your app.yaml, for example:

    gunicorn -b :$PORT main:app
    

提交回复
热议问题