STONEDSOUL

I wish I could give you meaningful additions

Migrating static contents from Page Creator to App Engine

I used Google Page Creator with Google Apps to host some static files, but it’s going to be closed soon. So, I migrated these contents to Google App Engine.

References

Create Account

  1. Login to Google App Engine with your Google Account
  2. Input your SMS account to receive App Engine Code.
  3. Press Create Application and input Google App Engine Code
  4. Input Application ID and Title

Set up Application with Google App Engine Launcher (Mac OSX)

  1. Download Google App Engine SDK
  2. Put Google App Engine Launcher to Application
  3. Run Google App Engine Launcher
  4. Click ‘+’ to Create Application
  5. Input Application name and specify directory for your application
  6. Press Create

Create Directory for static contents

  1. Create directory under your application directory (*.yaml and main.py have been created when you create application with the above steps.)

    yourappdirectory/
    +- assets/
    |  +- archives/
    |  +- css/
    |  +- html/
    |  +- img/
    |  +- js/
    |  +- xml/
    |
    +- app.yaml
    +- index.yaml
    +- main.py
    
  2. Edit app.yaml file in your root directory (application directory, yourappdirectory/app.yaml in the above example.)

    application: yourappname
    version: 1
    runtime: python
    api_version: 1
    
    handlers:
    - url: /(.*\.zip)
      static_files: assets/archive/\1
      upload: assets/archive/(.*\.zip)
    
    - url: /(.*\.css)
      static_files: assets/css/\1
      upload: assets/css/(.*\.css)
    
    - url: /(.*\.html)
      static_files: assets/html/\1
      upload: assets/html/(.*\.html)
    
    - url: /(.*\.(gif|png|jpg))
      static_files: assets/img/\1
      upload: assets/img/(.*\.(gif|png|jpg))
    
    - url: /(.*\.js)
      static_files: assets/js/\1
      upload: assets/js/(.*\.js)
    
    - url: /(.*\.xml)
      static_files: assets/xml/\1
      upload: assets/xml/(.*\.xml)
    
    - url: /
      static_files: assets/html/index.html
      upload: assets/html/index.html
    
    - url: /index.html
      static_files: assets/html/index.html
      upload: assets/html/index.html
    
    - url: .*
      script: main.py
    

As you may noticed, in the above app.yaml example, all static files are accessible on root directory. This is because I uplaoded these files on root directory by Google Page Creator and I don’t want to change link to my static files.

Testing

  1. Press Run button on Google App Engine Launcher
  2. Access to http://localhost:8080/

Deploy

Google App Engine Launcher provides one click deployment. You just need to click Deploy in the toolbar.

Integrate with Google Apps

  1. Login to Google App Engine dashboard
  2. Go to ‘Versions’ under Administration menu in the sidebar
  3. Press ‘Add Domain’ button in ‘Domain Setup’
  4. Input your Domain Name and press ‘Add Dmain’ button
  5. In Google Apps Control Panel, check agreement and press ‘Activate This Service’
  6. You can set up subdomain for your App Engine
  7. Set up DNS of your domain. Add ‘ghs.google.com.’ for the subdomain to your ‘CNAME’ setting
Page 1 of 1

powered by Tumblr