开发者

How do I download the source code of a google app engine project?

This seems like it shou开发者_JAVA技巧ld be very easy but I don't see a link to it anywhere.

How do I download the source code of a google app engine project?


Windows

appengine-java-sdk\bin\appcfg.cmd -A <your_app_id> -V <your_app_version> download_app <output-dir>

Linux

./appengine-java-sdk/bin/appcfg.sh -A <your_app_id> -V <your_app_version> download_app <output-dir>


For completeness, using the Python implementation:

appcfg.py download_app -A $appID -V $appVersionNumber $downloadDirectory --oauth2

--oauth2 is of course optional, you can omit it and provide your email + app-specific password (or your password, and then go implement two-factor authentication right after), but it's easier, and frankly there's no reason not to.

Documentation.


App Engine actually recently added the ability for the developer who uploaded a given app version to download its source code.


As of October 2019 you can simply go to --> App Engine --> Services and in the tool dropdown select 'source' and the source code is there


Posting this since none of the listed methods above didn't take me to the code (by June 2021)

You could try accessing it through;

Google Cloud Platform > Debugger > choosing the version of the Application from combo at top.

This will list the files of that version on the left pane. There is no way to download it automatically but you can copy-paste the code.

Hope you will find this helpful.


IMHO, the best option today (Aug 2018) is:

Under the main menu, under Products, go to Tools -> Cloud Build -> Build history.

There, click the ID of the build you want (for me - the last one).

Then, in the opened window (Build details), click the "source" link, the download of your compressed code begins.

As simple as that.

HTH.


Working with App engine standard using Go, the debugger isn't available yet.

How I managed to download the source code for an existing service was to use the gcloud tool.

First: Get the version id of your service using the app engine console or running: gcloud app versions list

Second: use the version and service name and run: gcloud app versions describe <versionID> --service=<service name>

the describe parameter will give you the storage locations for your source files that looks like this:

cmd/main.go:
      sha1Sum: e3fe5848c2640eca7ac3591490e1debc2d3a9b09
      sourceUrl: https://storage.googleapis.com/<project>/<file id>

Third: you can then use the storage console, using the file id, to download the files you are interested in.


this process based on java sdk Its works for me...

  1. Download Google cloud SDK gcloud init enter image description here

  2. Follow through process of logging in using your credentials

  3. Enter following command from SDK

    C:\Program Files (x86)\Google\appengine-java-sdk-1.9.49\bin

enter image description here

  1. Enter Following command to download source code

    appcfg.sh -A [YOUR_APP_ID] -V [YOUR_APP_VERSION] download_app [OUTPUT_DIR]

    Eg: appcfg.sh -A my-project-name-1234 -V 2 download_app C:\Users\india\Desktop\my project

    Note: this progress based on java-appengine sdk so we use appcfg.sh instead of appcfg.py


check if your app is uploaded with same email id that is in your app engine. if you are not sure then in app engine > control > Clear deployment credentials and then click on any project, deploy to sign in again then use this

appcfg.py download_app -A {app id from google app engine} -V {1} "{c:\path}" --oauth2_credential_file=C:\Users\{your account name}/.appcfg_oauth2_tokens

change all {} to your needs


Things have changed since this question was asked so I'm adding an updated answer. Note that this only applies to GAE Standard Environment

Google has deprecated appcfg.py and so the previous responses appcfg.py download_app no longer works.

  1. gcloud which is the SDK in use (it replaced appcfg) does not have the functionality to download your source code.
  2. When you deploy your app via gcloud app deploy, it copies your source code to a bucket. The default bucket is staging.<project_name>.appspot.com. Your files will stay in this bucket for a maximum of 15 days before they are deleted. You can modify the rule so that the files are retained for longer or less time.
  3. The file names in the bucket are encoded so you can't figure out what each file is unless you open it (i.e. download it). Google has a mapping of the encoded names to the original file names. To get this mapping, you run the gcloud app versions describe command and it will list the file names and their encoded names. To download the files, you have to manually click each url one by one. So essentially, you have to download each file manually and then use the mapping to rename them (or open the file, check the content and then rename them). Also note that downloading the files manually will not maintain the folder structure in which they were uploaded.
  4. If you do not wish to go through all of the above hassles (imagine having to manually open each url for each file if you have a small to mid-sized project which has hundreds of files), our App - https://nocommandline.com - now supports downloading source code from the default bucket - staging.<project_name>.appspot.com (so far as your files are still there which means any deployment i.e update not older than 15 days from your current date unless you previously increased the deletion age on your staging bucket's lifecycle page).
  5. In simple terms, you enter your project name, the version number and our App will take care of retrieving the original file name to encoded name mapping, automatically downloading the files and renaming them to the original names, while maintaining the folder structure. For more information, refer to https://nocommandline.com/help/#faq_download_source_code_from_gae.


Log in to the console.developers.google.com Select the project you want to download the code from (Google App Engine Standard Envoronment). Go to the App Engine Dashboard. Under Summary is Debug and Source. Click on Source. Select each file one at a time and copy it (highlight the code, copy and paste into your local editor.) Select the next file....


You need to use svn to checkout the files.

If you are on Windows, you can use tortoise svn for your GUI end.

Here are tutorials on how to do it, here is the related question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜