Google App Engine on Windows

My first attempt at AppEngine resulted in having to hack the python that comes with it. It has since been changed and works much better!

For the life of me, the Google App Engine "Quick Start" wasn't working for me for starting up the development server in Go. The command listed as "dev_appserver.py app.yaml" is the one I'm referring to. Windows kept asking me which program I wanted to use to run it.

Trying to avoid installing another copy of python, since it comes with the Google Cloud SDK, and I knew the "gcloud" command used python, I decided to look for that gcloud.cmd. And I found it. And I copied it. Only to run the dev_appserver.py instead of gcloud.py :)

Here it is. Just put it alongside the dev_appserver.py and it'll run fine.

 


@echo off

SETLOCAL

SET "CLOUDSDK_ROOT_DIR=%~dp0.."
SET "PATH=%CLOUDSDK_ROOT_DIR%\bin\sdk;%PATH%"

SETLOCAL EnableDelayedExpansion

IF "%CLOUDSDK_PYTHON%"=="" (
  SET BUNDLED_PYTHON=!CLOUDSDK_ROOT_DIR!\platform\bundledpython\python.exe
  IF EXIST !BUNDLED_PYTHON! (
    SET CLOUDSDK_PYTHON=!BUNDLED_PYTHON!
  ) ELSE (
    SET CLOUDSDK_PYTHON=python.exe
  )
)
IF "%CLOUDSDK_PYTHON_SITEPACKAGES%" == "" (
  IF "!VIRTUAL_ENV!" == "" (
    SET CLOUDSDK_PYTHON_SITEPACKAGES=
  ) ELSE (
    SET CLOUDSDK_PYTHON_SITEPACKAGES=1
  )
)
SET CLOUDSDK_PYTHON_ARGS_NO_S=!CLOUDSDK_PYTHON_ARGS:-S=!
IF "%CLOUDSDK_PYTHON_SITEPACKAGES%" == "" (
  IF "!CLOUDSDK_PYTHON_ARGS!" == "" (
    SET CLOUDSDK_PYTHON_ARGS=-S
  ) ELSE (
    SET CLOUDSDK_PYTHON_ARGS=!CLOUDSDK_PYTHON_ARGS_NO_S! -S
  )
) ELSE IF "!CLOUDSDK_PYTHON_ARGS!" == "" (
  SET CLOUDSDK_PYTHON_ARGS=
) ELSE (
  SET CLOUDSDK_PYTHON_ARGS=!CLOUDSDK_PYTHON_ARGS_NO_S!
)


SETLOCAL DisableDelayedExpansion


"%COMSPEC%" /C ""%CLOUDSDK_PYTHON%" %CLOUDSDK_PYTHON_ARGS% "%~dp0\dev_appserver.py"" %*

blog comments powered by Disqus