The appcfg.py
command takes a set of options, an action, and arguments for the
action. This command is used for a variety of application management tasks
including deploying your app and
updating datastore indexes.
The appcfg
tool is included with the original App Engine SDK only, which you
can download and install at original App Engine SDK for PHP 5.
The App Engine SDK is updated frequently, and this list of arguments might not
be current. Type appcfg.py help
to see the list of all available actions, and
appcfg.py help <action>
for details on a particular action.
update
appcfg.py [options] update <app-directory>|<files...>
The update action creates or updates the app version named in the
app.yaml
file at the top level of the directory.If you specify a directory, it must contain an
app.yaml
file and all of the other files required by the app or the module that theapp.yaml
file defines.If the directory contains any global application settings files (
index.yaml
,queues.yaml
,dispatch.yaml
,dos.yaml
,cron.yaml
), use the update command that is specific to each of these to deploy that configuration file. For example, useupdate_dispatch
to deploy the dispatch file,update_cron
to deploy the cron file, and so forth.The command follows symlinks and recursively uploads all files to the server. Temporary or source control files, such as
foo~
,.svn/*
are skipped.Use the files argument to upload one or more YAML files that define modules. No other types of YAML files can appear in the command line. Only the specified modules will be updated.
The following option applies to
update
:--max_size
- Maximum size of a file to upload (in bytes).
help
appcfg.py help <action>
- Prints a help message about the given action, then quits.
cron_info
appcfg.py [options] cron_info <app-directory>
- Displays information about the scheduled task (cron) configuration,
including the expected times of the next few executions. By default,
displays the times of the next 5 runs. You can modify the number of future
run times displayed with the
--num_runs=...
option.
download_app
appcfg.py download_app -A <project_id> -V <version> <output-dir>
Retrieves the most current version of your application's code using the following options:
-A
- Required. The project ID.
-V
- Optional. Specifies the version of the code to download. If omitted, the default version is downloaded.
<output-dir>
- Required. The directory where you wish to save the files.
request_logs
appcfg.py [options] request_logs <app-directory> <output-file>
Retrieves log data for the application running on App Engine. If the
--append
flag is set,output-file
parameter is the name of the file to create, replace, or append. Ifoutput-file
is a hyphen (-
), the log data is printed to the console. The following options apply torequest_logs
:--num_days=...
- The number of days of log data to retrieve, ending on the current date
at midnight UTC. A value of 0 retrieves all available logs. If
--append
is given, then the default is 0, otherwise the default is 1. --end_date=...
The latest date of log data to return, in the form
YYYY-MM-DD
. The default is today. The--num_days
option counts backwards from the end date.--severity=...
The minimum log level for the log messages to retrieve. The value is a number corresponding to the log level: 4 for CRITICAL, 3 for ERROR, 2 for WARNING, 1 for INFO, 0 for DEBUG. All messages at the given log level and above are retrieved. Default is 1 (INFO).
--append
Append the fetched data to the output file, starting with the first log line not already present in the file. Running this action once a day with
--append
results in a file containing all log data.The default is to overwrite the output file. Does not apply if
output-file
is-
(printing to the console).--vhost=...
If present, limits the log messages downloaded to just those emitted by requests for a given domain name. For example,
--vhost=google.com
downloads just the log messages for the live app at the G Suite domaingoogle.com
, excluding any log messages emitted by a new version being tested athttps://2-dot-latest-dot-your_project_id.[REGION_ID].r.appspot.com
. Similarly,--vhost=2.latest.your_project_id.[REGION_ID].r.appspot.com
downloads just the logs for the test version, excluding the live version.The value is a regular expression that matches the
Host
header of the incoming requests. Note that the pattern is case sensitive, even though domain names usually are not.--include_vhost
Include the domain name for each request (the
Host
request header) in the request log data, as an additional field.
rollback
appcfg.py [options] rollback <app-directory>
- Reverses a partially completed update for the given application. You can use this if an update was interrupted, and the command is reporting that the application cannot be updated due to a lock.
set_default_version
appcfg.py [options] set_default_version <app-directory>
- Specifies the default version of the given module.
migrate_traffic
appcfg.py [options] migrate_traffic <app-directory>
- Implements traffic migration. Dynamically re-routes traffic from the current default (serving) version of the app to the version specified in the app.yaml. Traffic is moved from the old to the new version in a few minutes, depending on how much traffic your app is receiving and how many instances are running. Once all traffic is migrated, the default (serving) version of the app is reset to the new version.
list_versions
appcfg.py [options] list_versions <app-directory>
- Outputs the uploaded versions for each module of an application in YAML. The
YAML is formatted as an associative array, mapping
module_ids
to the list of versions uploaded for that module. The default version is first in the list.
delete_version
appcfg.py [options] delete_version -A project_id -V version
- Deletes the specified version for the specified application.
update_cron
appcfg.py [options] update_cron <app-directory>
- Updates the schedule task (cron) configuration for the app, based on the
cron.yaml
file.
update_dos
appcfg.py [options] update_dos <app-directory>
- Updates the DoS Protection configuration for the app, based on the
dos.yaml
file.
update_queues
appcfg.py [options] update_queues <app-directory>
- Updates the task queue configuration for the app, based on the
queue.yaml
file.
update_dispatch
appcfg.py [options] update_dispatch <app-directory>
- Updates the dispatch for the app, based on the
dispatch.yaml
file.
start_module_version
appcfg.py [options] start_module_version <app-directory>
Start the specified module version.
Use the
--module
and--version
options to override the settings in theapp.yaml
file.
stop_module_version
appcfg.py [options] stop_module_version <app-directory>
Stop the specified module version.
Use the
--module
and--version
options to override the settings in theapp.yaml
file.
Global options
The appcfg.py
command accepts the following options for all actions:
--application=...
- The project ID to use. By default, this is derived from the
application:
line in theapp.yaml
file in the application directory. If--application
is specified, it overrides the ID inapp.yaml
for this action.
--host=...
- The hostname of the local machine for use with remote procedure calls.
--max_size=...
- A maximum size of files to upload, as a number of bytes. Files larger than
this size will not be uploaded. The default is
10485760
. The server enforces a maximum file size of 10,485,760 bytes, so increasing this value will not have any effect. --module=...
- The name of the module to use. By default, this is derived from the
module:
line in theapp.yaml
file in the application directory. If--module
is specified, it overrides the value inapp.yaml
for this action. - Do not store the user's access token. Go through the OAuth2 flow every time.
--noisy
- Print many messages about what the command is doing. This is mostly useful when working with the App Engine team to troubleshoot an upload issue.
--noauth_local_webserver
- Don't use the web browser to display web pages for authentication. This is useful for OAuth2 authentication if you're remotely logged on to a machine. This flag only applies for OAuth2.
--oauth2_refresh_token=token
- Use an OAuth2 refresh token to authenticate instead of the default one stored in the user's home directory.
--quiet
- Do not print messages when successful.
--server=...
- The App Engine server hostname. The default is
appengine.google.com
. --verbose
- Print messages about what the command is doing.
--version=...
- The version ID to use. By default, this is derived from the
version:
line in theapp.yaml
file in the application directory. If--version
is specified, it overrides the version ID inapp.yaml
for this action.