2013-10-22 218 views

回答

6

在您的計算機上登錄install the SDK之後,您將擁有一個google_appengine目錄。我運行Windows所以礦山位於:

C:\ Program Files文件(x86)的\谷歌\ google_appengine

那個目錄中,被稱爲 「dev_appserver.py」 python腳本這是什麼教程希望你運行。你的本地機器也應該安裝PHP,並且腳本正在尋找這個位置,因爲它會是你自己安裝的。

您將從您OS的任何本地命令行應用程序(Linux的shell,Mac中的終端,Windows中的命令提示符或Powershell)執行此腳本。

我從我的GAE應用程序存儲的一級以上的文件夾執行我的程序。爲了確保你能正確地執行該命令,不帶參數運行它,你應該看到這一點:

蟒蛇 「C:\ Program Files文件(x86)的\谷歌\ 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中獲得了這個輸出結果,並能夠擊中本地URL並查看「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

Google雲SDK附帶一個Launcher,您可以在其中添加項目文件並檢查GUI中的日誌。我在這裏使用了python代碼,但它應該和php一樣。

去谷歌應用程序引擎啓動 - >選擇文件 - >添加現有應用程序 - >瀏覽並選擇你的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 
相關問題