2013-10-22 16 views
5

Sto attraversando il tutorial helloworld per Google App Engine utilizzando PHP (https://developers.google.com/appengine/docs/php/gettingstarted/helloworld). Dopo aver ottenuto l'applicazione configurato e pronto ad andare il tutorial mi dice di avviare il server web incluso con il Google App Engine SDK utilizzando il comando: google_appengine/dev_appserver.py --php_executable_path = helloworld /. In che modo esattamente avvio il web server e dove inserisco quel comando?Avvio di Google App Engine Web Server

risposta

6

Dopo aver install the SDK sulla vostra macchina avrete una directory google_appengine. Eseguo Windows in modo da miniera si trova a:

C: \ Program Files (x86) Google \ google_appengine

Dentro quella directory \ è uno script python chiamato "dev_appserver.py", che è ciò che il tutorial ti vuole correre. La tua macchina locale dovrebbe avere anche PHP installato e lo script sta cercando la posizione in quanto sarebbe un qualcosa che dovresti installare da solo.

Potrai eseguire questo script da qualsiasi locale applicazione a riga di comando del sistema operativo ha (shell per Linux, terminale in Mac, prompt dei comandi o Powershell in Windows).

eseguo la mia da livello di cartella quello sopra la mia domanda GAE viene memorizzato. Per garantire la si può eseguire correttamente questo comando, eseguirlo senza parametri e si dovrebbe vedere questo:

python "C: \ Program Files (x86) \ Google \ google_appengine \ dev_appserver.py"

uscita:

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 

mio comando per ottenere questo lavoro correttamente è stato:

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\ 

Ho ottenuto questo output in Powershell e sono riuscito a scrivere l'url locale e vedere "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

La nube SDK di Google viene fornito con un pulsante di avvio in cui si potrebbe aggiungere i file di progetto ed esaminare i log nella GUI. Ho usato il codice Python qui, ma dovrebbe comportarsi allo stesso modo con PHP.

Vai a Avvio di Google App Engine -> Seleziona file -> Aggiungi applicazione esistente -> Sfoglia e seleziona la directory radice dell'applicazione PHP/Python/Java/Go -> Aggiungi -> Fai clic sul pulsante Esegui -> Fai clic su Registri

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