我只是在理解为什么这个命令时遇到了一些麻烦:
>appcfg.py -A adept-box-109804 update app.yaml
由Try Google App Engine Now页面提供的功能不起作用.我已下载App Engine SDK for Python,并将Path设置为指向appcfg.py的位置,但在我的项目根目录中运行appcfg.py在命令行中不起作用.我要么导航到包含appcfg.py的文件夹并执行操作
>python appcfg.py help
或者做
>python "C:\Program Files (x86)\Google\google_appengine\appcfg.py" help
从任何地方获得命令.我使用后一种方法来部署我的测试应用程序,但只是想知道是否有人可以解释为什么简单的Google教程给出的命令没有做任何事情.我还检查了确保.py文件是使用Python 2.7解释器自动打开的,这样只需输入一个文件hello.py就可以在命令行中执行
>hello.py
它将输出其打印声明.另一方面,使用appcfg.py以类似的方式提供相同的输出,无论参数如何(请注意我截断了输出,但请放心,无论参数如何,它们都是相同的:
C:\>appcfg.py help backends Usage: appcfg.py [options] <action> Action must be one of: backends: Perform a backend action. backends configure: Reconfigure a backend without stopping it. backends delete: Delete a backend. backends list: List all backends configured for the app. backends rollback: Roll back an update of a backend. backends start: Start a backend. backends stop: Stop a backend. backends update: Update one or more backends. create_bulkloader_config: Create a bulkloader.yaml from a running application. cron_info: Display information about cron jobs. delete_version: Delete the specified version for an app. download_app: Download a previously-uploaded app. download_data: Download entities from datastore. help: Print help for a specific action. list_versions: List all uploaded versions for an app. request_logs: Write request logs in Apache common log format. resource_limits_info: Get the resource limits. rollback: Rollback an in-progress update. set_default_version: Set the default (serving) version. start_module_version: Start a module version. stop_module_version: Stop a module version. update: Create or update an app version. update_cron: Update application cron definitions. update_dispatch: Update application dispatch definitions. update_dos: Update application dos definitions. update_indexes: Update application indexes. update_queues: Update application task queue definitions. upload_data: Upload data records to datastore. vacuum_indexes: Delete unused indexes from application. Use 'help <action>' for a detailed description. C:\>appcfg.py help update Usage: appcfg.py [options] <action> Action must be one of: backends: Perform a backend action. backends configure: Reconfigure a backend without stopping it. backends delete: Delete a backend. backends list: List all backends configured for the app. backends rollback: Roll back an update of a backend. backends start: Start a backend. backends stop: Stop a backend. backends update: Update one or more backends. create_bulkloader_config: Create a bulkloader.yaml from a running application. cron_info: Display information about cron jobs. delete_version: Delete the specified version for an app. download_app: Download a previously-uploaded app. download_data: Download entities from datastore. help: Print help for a specific action. list_versions: List all uploaded versions for an app. request_logs: Write request logs in Apache common log format. resource_limits_info: Get the resource limits. rollback: Rollback an in-progress update. set_default_version: Set the default (serving) version. start_module_version: Start a module version. stop_module_version: Stop a module version. update: Create or update an app version. update_cron: Update application cron definitions. update_dispatch: Update application dispatch definitions. update_dos: Update application dos definitions. update_indexes: Update application indexes. update_queues: Update application task queue definitions. upload_data: Upload data records to datastore. vacuum_indexes: Delete unused indexes from application. Use 'help <action>' for a detailed description.您的混淆可能源于混合了两种可能的调用样式:
> python appcfg.py … > appcfg.py …
第一个不能利用appcfg.py的位置在路径中的事实,它只是python可执行文件的参数,它无法找到appcfg.py文件,除非:
>它在当前目录中找到它 >使用完整路径或相对于调用python的当前工作目录的路径指定appcfg.py文件
这就是你的第二和第三个命令无法正常工作的原因.如果appcfg.py的位置在路径中,则使用第二个调用样式应该有效 – 就像上次命令调用一样.
需要记住的关键点:路径配置仅适用于命令可执行文件,而不适用于其参数(BTW每个可执行文件可以按照自己的意愿处理,一些可执行文件可以将参数与路径配置组合以获取文件的位置).
类似地,appcfg.py本身(一旦使用2种调用样式中的任何一种成功调用)需要能够找到指定为参数的app.yaml文件.除非有以下情况,否则不能这样做:
>它在当前目录中找到它 >使用完整路径或相对于当前工作目录的路径指定app.yaml文件(或其目录),从中调用appcfg.py
我怀疑appcfg.py无法找到你的app.yaml文件可能是你提到的第一个命令不起作用的原因.如果没有,您应该提供有关失败的详细信息.
关于为什么你的上一个命令的输出无论参数如何都是相同的,我不确定,它可能是SDK的Windows版本中的一个错误.在 Linux 中,输出是不同的:
> appcfg.py help backends
Usage: appcfg.py [options] backends <directory> <action>
Perform a backend action.
The 'backends' command will perform a backends action.
Options:
-h, --help Show the help message and exit.
-q, --quiet Print errors only.
-v, --verbose Print info level logs.
--noisy Print all logs.
-s SERVER, --server=SERVER
The App Engine server.
-e EMAIL, --email=EMAIL
The username to use. Will prompt if omitted.
-H HOST, --host=HOST Overrides the Host header sent with all RPCs.
--no_cookies Do not save authentication cookies to local disk.
--skip_sdk_update_check
Do not check for SDK updates.
-A APP_ID, --application=APP_ID
Set the application, overriding the application value
from app.yaml file.
-M MODULE, --module=MODULE
Set the module, overriding the module value from
app.yaml.
-V VERSION, --version=VERSION
Set the (major) version, overriding the version value
from app.yaml file.
-r RUNTIME, --runtime=RUNTIME
Override runtime from app.yaml file.
-E NAME:VALUE, --env_variable=NAME:VALUE
Set an environment variable, potentially overriding an
env_variable value from app.yaml file (flag may be
repeated to set multiple variables).
-R, --allow_any_runtime
Do not validate the runtime in app.yaml
--oauth2 Ignored (OAuth2 is the default).
--oauth2_refresh_token=OAUTH2_REFRESH_TOKEN
An existing OAuth2 refresh token to use. Will not
attempt interactive OAuth approval.
--oauth2_access_token=OAUTH2_ACCESS_TOKEN
An existing OAuth2 access token to use. Will not
attempt interactive OAuth approval.
--authenticate_service_account
Authenticate using the default service account for the
Google Compute Engine VM in which appcfg is being
called
--noauth_local_webserver
Do not run a local web server to handle redirects
during OAuth authorization.
查看更多关于python-2.7 – appcfg.py无法在命令行中运行的详细内容...