-
Notifications
You must be signed in to change notification settings - Fork 64
local devserver command
The local development server (dev_appserver.py) is part of the App Engine
components of the gcloud CLI. This topic provides advanced
information about the dev_appserver.py usage.
See Using the Local Development Server for more information about local testing.
Important: Before running the local development server, follow the setup instructions.
Important:
- Before running the local development server, follow the setup instructions.
- The `dev_appserver` tool does not support development of Python 3 apps on Windows.
A sample dev_appserver.py command might look as follows:
python2 *DEVAPPSERVER_ROOT*/google_appengine/dev_appserver.py *OPTION* yaml_path *FILES*
Replace the following:
-
DEVAPPSERVER_ROOT with the path to the root directory
where you extract the archived version of
devapp_server.py. For more information about downloading and using the archived version ofdev_appserver.py, see Using the local development server. - OPTION with a flag supported by the local development server.
-
FILES specifies one or more
app.yamlfiles, one per service, for the positional argumentyaml_path.
For a complete list of options, run the following:
DEVAPPSERVER_ROOT/google_appengine/dev_appserver.py -h
The most common options are as follows:
--admin_host=ADMIN_HOST : Host name to which the local development server's
administration console should bind (default: localhost).
--admin_port=ADMIN_PORT : Port to which the local development server's
administration console should bind (default: 8000).
--enable_sendmail=yes|no : Uses the local computer's Sendmail installation for
sending email messages.
--help : Prints a helpful message then quits.
--host=... : The host address to use for the server. You may need to set this
to be able to access the development server from another computer on your
network. An address of 0.0.0.0 allows both localhost access and IP or hostname
access. Default is localhost.
--log_level=... : The lowest logging level at which logging messages will be
written to the console; messages of the specified logging level or higher will
be output. Possible values are debug, info, warning, error, and
critical.
--port=... : The port number to use for the server. Default is 8080. If
multiple servers are launched such as for services, they will be assigned
subsequent ports, such as 8081, 8082.
--logs_path=... : By default, the logs for the local development server are
stored in memory only. Specify this option when you run the local development
server to store the logs into a file, which makes the logs available across
server restarts. You must specify the directory path and name to a SQLite
database file. A SQLite database file is created with the specified name if the
file does not already exist. For example: --logs_path=/home/logs/boglogs.db
--require_indexes=yes|no : Disables automatic generation of entries in the
index.yaml file. Instead, when the application makes a query that requires
that its index be defined in the file and the index definition is not found, an
exception will be raised, similar to what would happen when running on App
Engine. The default value is no.
--smtp_host=... : The hostname of the SMTP server to use for sending email
messages.
--smtp_port=... : The port number of the SMTP server to use for sending email
messages.
--smtp_user=... : The username to use with the SMTP server for sending email
messages.
--smtp_password=... : The password to use with the SMTP server for sending
email messages.
--storage_path=... : Path at which all local files, such as the Datastore,
Blobstore, Cloud Storage files and logs, will be stored, unless overridden by
--datastore_path, --blobstore_path, or --logs_path.
--support_datastore_emulator=yes|no : Use the Cloud Datastore Emulator (beta)
for local datastore emulation.
--datastore_emulator_port=... : The port number to use for Cloud Datastore
Emulator (beta).
--env_var=... : User defined environment variable for the local runtime
process. Each env_var is in the format of key=value, and you can define
multiple environment variables. In addition to env_variables in the
app.yaml, this flag allows setting extra environment variables for local
processes. For example:--env_var KEY_1=val1 --env_var KEY_2=val2