Use the local development server after runtimes reach end of support

You can't use the latest version ofdev_appserver.py to locally run yourapplications for runtimes that reachedend of support.To continue using an archived version ofdev_appserver.py, follow the instructions in this guide.

You can use the local development server to simulaterunning your App Engine application in production, as well as using 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.

Before you begin

To download an archived version ofdevapp_server.py, follow these steps:

  1. From thearchive, download the zipped folder that contains thedev_appserver.py server for runtimes that have reached the end of support.

  2. Extract the directory's contents to your local file system, such as to your/home directory. You can finddev_appserver.py in thegoogle_appengine/ directory.

Set up the local development server

To run the local development server tool, you must set up the following:

  1. Verify that you have installed a Python 2 interpreter of version 2.7.12 or later.

  2. Set theDEVAPPSERVER_PYTHON environment variable in your shell tothe path of your Python 2 interpreter.

  3. Locate thedev_appserver.py tool under the/google_appengine/ folder where youextract thedownloaded archive, for example:

    DEVAPPSERVER_ROOT/google_appengine/dev_appserver.py

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:

  1. In the directory that contains yourapp.yaml configuration file, run thedev_appserver.py command.

    Specify the directory path to your app, for example:

    python2DEVAPPSERVER_ROOT/google_appengine/dev_appserver.py--runtime_python_path=/usr/bin/python2 [PATH_TO_YOUR_APP]

    You can also set the argument to a comma-separated list of[RUNTIME_ID]=[PYTHON_INTERPRETER_PATH] pairs. For example:

    python2DEVAPPSERVER_ROOT/google_appengine/dev_appserver.py--runtime_python_path="python27=/usr/bin/python2.7" [PATH_TO_YOUR_APP]

    To change the port, include the--port option:

    python2DEVAPPSERVER_ROOT/google_appengine/dev_appserver.py--runtime_python_path=/usr/bin/python2 --port=9999 [PATH_TO_YOUR_APP]

    ReplaceDEVAPPSERVER_ROOT with the path to the folder where you extract thearchived version ofdevapp_server.py.

  2. The local development server is now running and listening for requests. You can visithttp://localhost:8080/ in your web browser to see the app in action.

    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

To access your App ID in the local server, for example to spoof an emailaddress, use theget_application_id() function.

To get the hostname of the running app, use theget_default_version_hostname() function.

Detect application runtime environment

To determine whether your code is running in production or in the localdevelopment server, you can check the value of theGAE_ENV environmentvariable:

if os.getenv('GAE_ENV', '').startswith('standard'):  # Production in the standard environmentelse:  # Local development server

Use the local Datastore service

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:

    python2DEVAPPSERVER_ROOT/google_appengine/dev_appserver.py --smtp_host=smtp.example.com --smtp_port=25 \  --smtp_user=ajohnson --smtp_password=k1tt3nsPATH_TO_YOUR_APP

Replace:

  • DEVAPPSERVER_ROOT with the path to the folder where youextract thearchived version ofdevapp_server.py.
  • --smtp_host,--smtp_port,--smtp_user and--smtp_password options with your own configuration values.
  • PATH_TO_YOUR_APP with the path to your application.

Using Sendmail

To enable mail support with Sendmail, invokedev_appserver.py as follows:

  python2DEVAPPSERVER_ROOT/google_appengine/dev_appserver.py --enable_sendmail=yesPATH_TO_YOUR_APP

Replace:

  • DEVAPPSERVER_ROOT with the path to the folder where youextract thearchived version ofdevapp_server.py.
  • PATH_TO_YOUR_APP with the path to your application.

The local server uses thesendmail command to send email messages withyour installation's default configuration.

Note: If you don't invokedev_appserver.py with either SMTP or Sendmail asdescribed, attempts to send email from your application donothing, but the attempt appears 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.

While running under the localdevelopment server, the functions return URLs for/_ah/login and/_ah/logout on the local server.

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.