Can I restore my source code that has been uploaded into Google AppEngine?

前端 未结 8 1710
旧巷少年郎
旧巷少年郎 2020-11-30 04:57

I recently had a hard drive crashed and lost all of my source code. Is it possible to pull/checkout the code that I have already uploaded to Google App Engine (like the most

8条回答
  •  天涯浪人
    2020-11-30 05:44

    Update as of October 2020.

    The current version of the Google App Engine SDK still includes the appcfg.py script however when trying to download the files from your site the script will attempt to download them into the root folder of your system.

    Example:

    /images/some_site_image.png
    

    This is probably related to changes in appengine where your files might have been in a relative directory before but they are no longer with the new versions of the system.

    To fix the problem you will have to edit the appcfg.py file in:

    /google-cloud-sdk/platform/google_appengine/google/appengine/tools/appcfg.py
    

    Around line 1634 you will find something that looks like:

    full_path = os.path.join(out_dir, path)
    

    The problem is with the path argument that for most files is a root directory. This causes the join method to ignore the out_dir argument.

    To fix this on a *NIX and MacOS type of system you will need to add a line before the above mentioned statement that looks like:

    path = re.sub(r'^/', '', path)
    

    This removes the '/' prefix from the path and allows the join method to properly connect the strings.

    Now you should be able to run:

    google-cloud-sdk/platform/google_appengine/appcfg.py download_app -A  -V  20200813t184800 
    

提交回复
热议问题