Using the local development server Stay organized with collections Save and categorize content based on your preferences.
dev_appserver.py to locally run yourapplications for runtimes that reachedend of support.To continue using an archived version ofdev_appserver.py, seeUse the local development server after runtimes reach the end of support.TheGoogle Cloud CLI includes a local development server(dev_appserver.py). You can use the local development server to simulaterunning your App Engine application in production as well as use it toaccess App Engine legacy bundled services. The simulated environment enforces some sandboxrestrictions, such as restricted system functions and runtime language moduleimports, but not others, like request timeouts or quotas.
The local development server also simulates the services provided by thelibraries in the SDK for App Engine, including Datastore, Memcache, andTask Queues, by performing their tasks locally. When your application isrunning in the development server, you can still make remote API calls to theproduction infrastructure by using the Google API HTTP endpoints.
Set up the local development server
To run the local development server tool, you must set up the following:
- Verify that you have installed a Python 3 interpreter that iscompatible with the Python version required by the gcloud CLI.
Verify that you have installed the Google Cloud CLI component that includes the App Engine extension for Python 3 (
app-engine-python):gcloud components listIf the
app-engine-pythoncomponent is not installed, run the followingcommand:gcloud components install app-engine-pythonLocate the installation path of Google Cloud SDK by running the followingcommand:
gcloud infoThe command returns the root directory where you installed Google Cloud SDK, forexample:
Installation Root: [/Users/myname/google-cloud-sdk]Locate the
dev_appserver.pytool under the/bin/folder where youinstalled Google Cloud CLI, for example:CLOUD_SDK_ROOT/bin/dev_appserver.pyNote the path to the
dev_appserver.pyfor later.
Run the local development server
Aftersetting up the local development server and creating theapp.yaml configuration file foryour app, you can use thedev_appserver.py command to run your app locally.
To start the local development server:
If you specified a custom port with the--port option, remember to open your browser to that port.
To stop the local server from the command line, press the following:
- macOS or Linux:Control+C
- Windows:Control+Break
Specify application IDs
Detect application runtime environment
Use the Mail service
The local development server can send email for calls to the App Enginemail service using either an SMTP server or a local installation ofSendmail.
Using SMTP
To enable mail support with an SMTP server, invokedev_appserver.py asfollows::
python3[CLOUD_SDK_ROOT]/bin/dev_appserver.py--smtp_host=smtp.example.com --smtp_port=25 \--smtp_user=ajohnson --smtp_password=k1tt3ns [PATH_TO_YOUR_APP]where you set the--smtp_host,--smtp_port,--smtp_user and--smtp_password options with your own values.
Using Sendmail
To enable mail support with Sendmail, invokedev_appserver.py as follows:
python3[CLOUD_SDK_ROOT]/bin/dev_appserver.py--enable_sendmail=yes [PATH_TO_YOUR_APP]The local server uses thesendmail command to send email messages withyour installation's default configuration.
dev_appserver.py with either SMTP or Sendmail asdescribed, then attempts to send email from your application will donothing, but the attempt will appear successful in your application.Use the URL Fetch service
When your application uses the URL fetch API to make an HTTP request, thelocal development server makes the request directly from your computer. TheURL Fetch behavior on the local server may differ from productionApp Engine if you use a proxy server for accessing websites.
Use the Users service
App Engine provides aUsers serviceto simplify authentication and authorization for your application. The localdevelopment serversimulates the behavior of Google Accountswith its own sign-in and sign-out pages.
Command-line arguments
For the local development server command options, seeLocal development server options.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.