从windows powershell启动dev_appserver.py给我“太少的参数”错误

时间:2017-04-04 16:38:20

标签: python powershell google-app-engine dev-appserver

我正在尝试从windows powershell运行dev_appserver.py命令(我在我有appl.yaml和main.py文件的文件夹中执行此操作)。我正在使用以下命令运行它:

python "C:\Users\Dachshund\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\dev_appserver.py"

它给了我错误信息

  

dev_appserver.py:错误:参数太少。

以下是输入命令后运行的详细信息。任何帮助都将非常感激。

PS C:\Users\Dachshund\Desktop\helloworld> python "C:\Users\Dachshund\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\dev_appserver.py"
usage: dev_appserver.py [-h] [-A APP_ID] [--host HOST] [--port PORT]
                        [--admin_host ADMIN_HOST] [--admin_port ADMIN_PORT]
                        [--auth_domain AUTH_DOMAIN] [--storage_path PATH]
                        [--log_level {debug,info,warning,critical,error}]
                        [--max_module_instances MAX_MODULE_INSTANCES]
                        [--use_mtime_file_watcher [USE_MTIME_FILE_WATCHER]]
                        [--threadsafe_override THREADSAFE_OVERRIDE]
                        [--php_executable_path PATH]
                        [--php_remote_debugging [PHP_REMOTE_DEBUGGING]]
                        [--php_gae_extension_path PATH]
                        [--php_xdebug_extension_path PATH]
                        [--appidentity_email_address APPIDENTITY_EMAIL_ADDRESS]
                        [--appidentity_private_key_path APPIDENTITY_PRIVATE_KEY_PATH]
                        [--python_startup_script PYTHON_STARTUP_SCRIPT]
                        [--python_startup_args PYTHON_STARTUP_ARGS]
                        [--jvm_flag JVM_FLAG] [--go_work_dir GO_WORK_DIR]
                        [--custom_entrypoint CUSTOM_ENTRYPOINT]
                        [--runtime RUNTIME] [--blobstore_path BLOBSTORE_PATH]
                        [--mysql_host MYSQL_HOST] [--mysql_port MYSQL_PORT]
                        [--mysql_user MYSQL_USER]
                        [--mysql_password MYSQL_PASSWORD]
                        [--mysql_socket MYSQL_SOCKET]
                        [--datastore_path DATASTORE_PATH]
                        [--clear_datastore [CLEAR_DATASTORE]]
                        [--datastore_consistency_policy {consistent,random,time}]
                        [--require_indexes [REQUIRE_INDEXES]]
                        [--auto_id_policy {sequential,scattered}]
                        [--logs_path LOGS_PATH]
                        [--show_mail_body [SHOW_MAIL_BODY]]
                        [--enable_sendmail [ENABLE_SENDMAIL]]
                        [--smtp_host SMTP_HOST] [--smtp_port SMTP_PORT]
                        [--smtp_user SMTP_USER]
                        [--smtp_password SMTP_PASSWORD]
                        [--smtp_allow_tls [SMTP_ALLOW_TLS]]
                        [--search_indexes_path SEARCH_INDEXES_PATH]
                        [--clear_search_indexes [CLEAR_SEARCH_INDEXES]]
                        [--enable_task_running [ENABLE_TASK_RUNNING]]
                        [--allow_skipped_files [ALLOW_SKIPPED_FILES]]
                        [--api_port API_PORT] [--grpc_api GRPC_APIS]
                        [--grpc_api_port GRPC_API_PORT]
                        [--automatic_restart [AUTOMATIC_RESTART]]
                        [--dev_appserver_log_level {debug,info,warning,critical,error}]
                        [--skip_sdk_update_check [SKIP_SDK_UPDATE_CHECK]]
                        [--default_gcs_bucket_name DEFAULT_GCS_BUCKET_NAME]
                        [--env_var ENV_VARIABLES]
                        [--google_analytics_client_id GOOGLE_ANALYTICS_CLIENT_ID]
                        [--google_analytics_user_agent GOOGLE_ANALYTICS_USER_AGENT]
                        yaml_path [yaml_path ...]
dev_appserver.py: error: too few arguments

1 个答案:

答案 0 :(得分:0)

您必须明确指定app.yaml或包含它的目录:

python "C:\Users\Dachshund\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\dev_appserver.py" app.yaml

或者只是:

python "C:\Users\Dachshund\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\dev_appserver.py" .

另一方面,如果您只是在Windows上运行dev_appserver.py app.yaml,您可能也会收到该错误,因为在使用文件关联时未传递参数,请始终使用python调用它以避免麻烦。