Reputation: 21361
I've got a local Python application configured with
runtime: python
in it's app.yaml
file. When starting the local development server with
dev_appserver.py app.yaml
all is fine.
Since GAE's Local Development Server uses Python2.7 by default, I now want to make use of Python3.x instead. According to Google's documentation, we have to use the flexible environment. Thus I'm changing app.yaml
to:
runtime: python
env: flex
runtime_config:
python_version: 3
Now dev_appserver.py app.yaml
spits out:
Under dev_appserver, runtime:python is not supported for Flexible environment.
The problem can be reproduced with Google's Hello World application that uses the flexible environment as well.
So locally we can't use Python3? How can we then run my Python3 code locally before uploading it?
Upvotes: 9
Views: 4781
Reputation: 6263
Adding an updated answer (in 2022)
Google App Engine supports running Python 3 Apps using dev_appserver.py
(not for Windows though)
Per their documentation, ....To run dev_appserver with a Python 3 interpreter, you must specify the --runtime_python_path=[PATH_TO_PYTHON3_BINARY] flag
....
Some of the bundled services (built-in APIs) like User, Memcache, Datastore, Namespace Manager are also now available for Python3 Apps. When you enable them and use dev_appserver.py
to run your Python3 App, you get the same behavior you're used to in Python2 i.e. you will get a simulated datastore, memcache, users, etc
Upvotes: 1
Reputation: 39814
Using the Local Development Server is applicable to the first generation standard environment apps only.
For running locally flexible env apps see Running locally:
You run your application locally with the native development tools that you usually use.
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
Update:
Support for the 2nd generation standard environment is limited, see Python 3.7 Local Development Server Options for new app engine apps
Upvotes: 9