Thursday, August 25, 2016

Hello world | Google App Engine | Python | Cloud9IDE (EDIT REQ)



Create following files in a directory by name helloWorld
           this setup is public on c9.io; to see click here
main.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import webapp2


class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('Hello, World!')

app = webapp2.WSGIApplication([
    ('/', MainPage),
], debug=True)


main_test.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
import webtest

import main


def test_get():
    app = webtest.TestApp(main.app)

    response = app.get('/')

    assert response.status_int == 200
    assert response.body == 'Hello, World!'


app.yaml
1
2
3
4
5
6
7
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: main.app


Run your project as follows :
python googleAppEngineSDK/google_appengine/dev_appserver.py --host $IP --port 8081 --admin_host $IP --admin_port 8082 projects/helloWorld

Setting up c9.io (ubuntu) with Google App Engine SDK - PYTHON

I try to cover as much of steps required as possible in my posts but dont include them all in one post so that one doesnt get bombarded with information. Please refere to pre-requisite section with reference sufficient for you; if it doesnt exist please mention so in comment.


Pre-requisite :
c9.io account
Create a workspace with Python Config

STEPS:
Go to shell copy paste one at a time
STEP(1) Get SDK from Google to you c9.io workspace
wget https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.40.zip
STEP(2) Unzip the sdk package
unzip google_appengine_1.9.40.zip
STEP(3) Set path variable for future reference
export PATH=$PATH:/home/ubuntu/workspace/googleAppEngineSDK/google_appengine/


Reference : Google Docs

Creating Sheet using Google Drive Excel (Shared Manner)

Step 1 Go to drive.google.com
You need to login using your google account (xyz@gmail.com/ xyz@company.com)
Step 2 Click on new and select sheets
Step 3 Set any name at top where it says Untitled sheet and press save
Step 4 Next click on share to share it with any email id.
Note: In case you are using company email id you can only share the document with other emails within company domain ex. xyz@company.com can share it with someone like abc@company.com and not abc@gmail.com (mostly.. exceptions can be added by company google account admin)
Share can be done in one of three manner :
  1. readonly : where in other user can only read the document contents
  2. comment : where in other user can read and comment on the document contents
  3. edit : where in other user can read, commment edit the document contents
There can be one more option for sharing sheet publicly with one of the above three manner. Which means any one with link can perform that specified operations. To do so you simply need to copy and message URL to your contact

Quick setup Phonegap Development Environment using Docker

INTRO NOTE : Pre-requisite is to have ubuntu 16.04 Following DIGITAL OCEAN tutorial for same...