This example uses the Google Drive SDK, Heroku and mongolab.
In order to run this example app, you'll need to set up a Google Drive SDK and deploy the app to a public server. Below we outline how to do so using free accounts from Heroku and MongoLabs.
We assume you're familiar with Git and have it installed.
-
Visit http://www.heroku.com and sign up.
-
Download the Heroku command line toolbelt from http://toolbelt.herokuapp.com/
-
From your command line, type
heroku login
and enter your account details. -
Change to the server-side subdirectory of this example.
-
Set up a git repository:
$ git init
-
Create a new app on Heroku:
heroku create --stack cedar
Note the URL of your live app.
- Visit code.google.com/apis/console and create new project.
- On API section turn on 'Drive API' and 'Drive SDK'
- On 'Credentials' section create new client ID (web application)
- 'Redirect URI' should be
<URL of your live app>/auth
- Download JSON and put this file to directory of this example (rename this file to 'secrets.json')
-
Visit https://mongolab.com and sign up.
-
In the 'Databases' section, click 'Add'.
-
Select the 'Free' plan on Amazon EC2, pick a database name, username and password.
-
Click on your new database and note the connection URL. It should look something like this:
mongodb://:@ds029807.mongolab.com:29807/
-
Copy this URL to
MONGO_CONNECTION_STRING
variable in drive.py file
-
Run the following git commands:
$ git add . $ git commit -m "Initial commit" $ git push heroku master
-
Auth you Google Drive account on
<your live Heroku URL>/auth
You can upload file to <your live Heroku URL>/upload
, in responce server return live file URL.