我正在使用PHP(https://developers.google.com/appengine/docs/php/gettingstarted/helloworld)浏览Google App Engine的helloworld教程。在设置好应用程序并准备好之后,教程告诉我使用以下命令启动Google App Engine SDK附带的Web服务器:google_appengine / dev_appserver.py --php_executable_path = helloworld /。我究竟如何启动Web服务器以及将该命令放在哪里?
答案 0 :(得分:6)
在您的计算机上install the SDK之后,您将拥有一个google_appengine目录。我运行Windows,因此我的位于:
C:\ Program Files(x86)\ Google \ google_appengine
在该目录中是一个名为“dev_appserver.py”的python脚本,这是教程要求你运行的。您的本地计算机也应安装PHP,并且脚本正在查找该位置,因为它将是您自己安装的。
您将从您的操作系统的任何本地命令行应用程序(Linux的shell,Mac中的终端,Windows的命令提示符或Powershell)中执行此脚本。
我从存储了GAE应用程序上一层的文件夹执行我的操作。为确保您可以正确执行此命令,请在不带参数的情况下运行它,您应该看到:
python“C:\ Program Files(x86)\ Google \ google_appengine \ dev_appserver.py”
输出:
usage: dev_appserver.py [-h] [--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]]
[--python_startup_script PYTHON_STARTUP_SCRIPT]
[--python_startup_args PYTHON_STARTUP_ARGS]
[--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]
[--prospective_search_path PROSPECTIVE_SEARCH_PATH]
[--clear_prospective_search [CLEAR_PROSPECTIVE_SEARCH]]
[--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]
[--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]
yaml_files [yaml_files ...]
dev_appserver.py: error: too few arguments
让我们正常工作的命令是:
python "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py" --port 8082 --admin_port 8083 --php_executable_path "C:\Program Files (x86)\NuSphere\PhpED\php54\php-cgi.exe" helloworld\
我在Powershell中获得了这个输出,并且能够点击当地网址并看到“Hellow,World!”
INFO 2013-10-22 16:04:27,039 sdk_update_checker.py:245] Checking for updates to the SDK.
INFO 2013-10-22 16:04:28,368 sdk_update_checker.py:261] Update check failed: HTTP Error 404: Not Found
WARNING 2013-10-22 16:04:28,398 api_server.py:332] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2013-10-22 16:04:28,405 api_server.py:139] Starting API server at: http://localhost:52150
INFO 2013-10-22 16:04:28,408 dispatcher.py:171] Starting module "default" running at: http://localhost:8082
INFO 2013-10-22 16:04:28,411 admin_server.py:117] Starting admin server at: http://localhost:8083
INFO 2013-10-22 16:04:31,980 module.py:608] default: "GET / HTTP/1.1" 200 13
INFO 2013-10-22 16:04:32,223 module.py:608] default: "GET /favicon.ico HTTP/1.1" 200 13
答案 1 :(得分:1)
Google云SDK附带一个启动器,您可以在其中添加项目文件并检查GUI中的日志。我在这里使用了python代码,但它应该与php相同。
转到Google App Engine启动器 - >选择文件 - >添加现有应用程序 - >浏览并选择PHP / Python / Java / Go应用程序的根目录 - >添加 - >点击运行按钮 - >单击日志
2014-12-30 01:02:57 Running command: "['C:\\Users\\gung13\\Anaconda\\pythonw.exe', 'C:\\Program Files\\Google\\Cloud SDK\\google-cloud-sdk\\platform\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=9080', '--admin_port=8001', u'C:\\Users\\gung13\\Desktop\\appengine-try-python-flask']"
INFO 2014-12-30 01:02:57,874 devappserver2.py:745] Skipping SDK update check.
INFO 2014-12-30 01:02:57,903 api_server.py:172] Starting API server at: http://localhost:62234
INFO 2014-12-30 01:02:57,905 dispatcher.py:186] Starting module "default" running at: http://localhost:9080
INFO 2014-12-30 01:02:57,907 admin_server.py:118] Starting admin server at: http://localhost:8001
INFO 2014-12-30 01:03:21,677 module.py:718] default: "GET / HTTP/1.1" 200 13
INFO 2014-12-30 01:03:21,986 module.py:718] default: "GET /favicon.ico HTTP/1.1" 404 27