Remove django sample (#591)
diff --git a/samples/django_sample/Makefile b/samples/django_sample/Makefile
deleted file mode 100644
index 35d29f0..0000000
--- a/samples/django_sample/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-pip:
- @pip install -r requirements.txt
-
-
-syncdb:
- @python manage.py syncdb
-
-
-run:
- @python manage.py runserver 0.0.0.0:8000
-
-
-setup: pip syncdb run
-
-
-shell:
- @python manage.py shell
-
-
-test:
- @python manage.py test
diff --git a/samples/django_sample/README b/samples/django_sample/README
deleted file mode 100644
index 3aaeda8..0000000
--- a/samples/django_sample/README
+++ /dev/null
@@ -1,4 +0,0 @@
-Sample app demonstrating using oauth2client and the Google+ API from Django.
-
-api: plus
-keywords: oauth2 django
diff --git a/samples/django_sample/__init__.py b/samples/django_sample/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/samples/django_sample/__init__.py
+++ /dev/null
diff --git a/samples/django_sample/client_secrets.json b/samples/django_sample/client_secrets.json
deleted file mode 100644
index a232f37..0000000
--- a/samples/django_sample/client_secrets.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "web": {
- "client_id": "[[INSERT CLIENT ID HERE]]",
- "client_secret": "[[INSERT CLIENT SECRET HERE]]",
- "redirect_uris": [],
- "auth_uri": "https://accounts.google.com/o/oauth2/auth",
- "token_uri": "https://accounts.google.com/o/oauth2/token"
- }
-}
diff --git a/samples/django_sample/manage.py b/samples/django_sample/manage.py
deleted file mode 100755
index 4146caa..0000000
--- a/samples/django_sample/manage.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/python
-from __future__ import absolute_import
-from django.core.management import execute_manager
-try:
- import settings # Assumed to be in the same directory.
-except ImportError:
- import sys
- sys.stderr.write("""Error: Can't find the file 'settings.py' in the
-directory containing %r. It appears you've customized things. You'll
-have to run django-admin.py, passing it your settings module.
-(If the file settings.py does indeed exist, it's causing an ImportError
-somehow.)\n""" % __file__)
- sys.exit(1)
-
-if __name__ == "__main__":
- execute_manager(settings)
diff --git a/samples/django_sample/plus/__init__.py b/samples/django_sample/plus/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/samples/django_sample/plus/__init__.py
+++ /dev/null
diff --git a/samples/django_sample/plus/models.py b/samples/django_sample/plus/models.py
deleted file mode 100644
index 46a0225..0000000
--- a/samples/django_sample/plus/models.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from django.contrib import admin
-from django.contrib.auth.models import User
-from django.db import models
-
-from oauth2client.contrib.django_util.models import CredentialsField
-
-
-class CredentialsModel(models.Model):
- id = models.ForeignKey(User, primary_key=True)
- credential = CredentialsField()
-
-
-class CredentialsAdmin(admin.ModelAdmin):
- pass
diff --git a/samples/django_sample/plus/tests.py b/samples/django_sample/plus/tests.py
deleted file mode 100644
index 927cadf..0000000
--- a/samples/django_sample/plus/tests.py
+++ /dev/null
@@ -1,24 +0,0 @@
-"""
-This file demonstrates two different styles of tests (one doctest and one
-unittest). These will both pass when you run "manage.py test".
-
-Replace these with more appropriate tests for your application.
-"""
-
-from django.test import TestCase
-
-
-class SimpleTest(TestCase):
-
- def test_basic_addition(self):
- """
- Tests that 1 + 1 always equals 2.
- """
- self.failUnlessEqual(1 + 1, 2)
-
-__test__ = {"doctest": """
-Another way to test that 1 + 1 is equal to 2.
-
->>> 1 + 1 == 2
-True
-"""}
diff --git a/samples/django_sample/plus/views.py b/samples/django_sample/plus/views.py
deleted file mode 100644
index bc45461..0000000
--- a/samples/django_sample/plus/views.py
+++ /dev/null
@@ -1,58 +0,0 @@
-import os
-import logging
-import httplib2
-
-from googleapiclient.discovery import build
-from django.contrib.auth.decorators import login_required
-from django.http import HttpResponseBadRequest
-from django.http import HttpResponseRedirect
-from django.shortcuts import render
-from django_sample.plus.models import CredentialsModel
-from django_sample import settings
-from oauth2client.contrib import xsrfutil
-from oauth2client.client import flow_from_clientsecrets
-from oauth2client.contrib.django_util.storage import DjangoORMStorage
-
-# CLIENT_SECRETS, name of a file containing the OAuth 2.0 information for this
-# application, including client_id and client_secret, which are found
-# on the API Access tab on the Google APIs
-# Console <http://code.google.com/apis/console>
-
-FLOW = flow_from_clientsecrets(
- settings.GOOGLE_OAUTH2_CLIENT_SECRETS_JSON,
- scope='https://www.googleapis.com/auth/plus.me',
- redirect_uri='http://localhost:8000/oauth2callback')
-
-
-@login_required
-def index(request):
- storage = DjangoORMStorage(CredentialsModel, 'id', request.user, 'credential')
- credential = storage.get()
- if credential is None or credential.invalid == True:
- FLOW.params['state'] = xsrfutil.generate_token(settings.SECRET_KEY,
- request.user)
- authorize_url = FLOW.step1_get_authorize_url()
- return HttpResponseRedirect(authorize_url)
- else:
- http = httplib2.Http()
- http = credential.authorize(http)
- service = build("plus", "v1", http=http)
- activities = service.activities()
- activitylist = activities.list(collection='public',
- userId='me').execute()
- logging.info(activitylist)
-
- return render(request, 'plus/welcome.html', {
- 'activitylist': activitylist,
- })
-
-
-@login_required
-def auth_return(request):
- if not xsrfutil.validate_token(settings.SECRET_KEY, request.REQUEST['state'],
- request.user):
- return HttpResponseBadRequest()
- credential = FLOW.step2_exchange(request.REQUEST)
- storage = DjangoORMStorage(CredentialsModel, 'id', request.user, 'credential')
- storage.put(credential)
- return HttpResponseRedirect("/")
diff --git a/samples/django_sample/requirements.txt b/samples/django_sample/requirements.txt
deleted file mode 100644
index 01ff083..0000000
--- a/samples/django_sample/requirements.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-Django==1.3
-google-api-python-client==1.6.2
-httplib2==0.10.3
-jsonpickle==0.9.4
-oauth2client==4.1.2
-pyasn1==0.2.3
-pyasn1-modules==0.0.9
-pytz==2017.2
-rsa==3.4.2
-six==1.10.0
-uritemplate==3.0.0
diff --git a/samples/django_sample/settings.py b/samples/django_sample/settings.py
deleted file mode 100644
index 76a16a8..0000000
--- a/samples/django_sample/settings.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# Django settings for django_sample project.
-import os
-
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-
-ADMINS = (
- # ('Your Name', 'your_email@domain.com'),
-)
-
-MANAGERS = ADMINS
-
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': 'mydatabase'
- }
- }
-
-# Local time zone for this installation. Choices can be found here:
-# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
-# although not all choices may be available on all operating systems.
-# If running in a Windows environment this must be set to the same as your
-# system time zone.
-TIME_ZONE = 'America/New_York'
-
-# Language code for this installation. All choices can be found here:
-# http://www.i18nguy.com/unicode/language-identifiers.html
-LANGUAGE_CODE = 'en-us'
-
-SITE_ID = 1
-
-# If you set this to False, Django will make some optimizations so as not
-# to load the internationalization machinery.
-USE_I18N = True
-
-# Absolute path to the directory that holds media.
-# Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = ''
-
-# URL that handles the media served from MEDIA_ROOT. Make sure to use a
-# trailing slash if there is a path component (optional in other cases).
-# Examples: "http://media.lawrence.com", "http://example.com/media/"
-MEDIA_URL = ''
-
-# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
-# trailing slash.
-# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = '/media/'
-
-# Make this unique, and don't share it with anybody.
-SECRET_KEY = '_=9hq-$t_uv1ckf&s!y2$9g$1dm*6p1cl%*!^mg=7gr)!zj32d'
-
-# List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.Loader',
- 'django.template.loaders.app_directories.Loader',
-)
-
-MIDDLEWARE_CLASSES = (
- 'django.middleware.common.CommonMiddleware',
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- 'django.middleware.csrf.CsrfViewMiddleware',
-)
-
-ROOT_URLCONF = 'django_sample.urls'
-
-TEMPLATE_DIRS = (
- # Put strings here, like "/home/html/django_templates"
- # Always use forward slashes, even on Windows.
- # Don't forget to use absolute paths, not relative paths.
- os.path.join(os.path.dirname(__file__), 'templates')
-)
-
-INSTALLED_APPS = (
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.sites',
- 'plus'
-)
-
-GOOGLE_OAUTH2_CLIENT_SECRETS_JSON = 'client_secrets.json'
diff --git a/samples/django_sample/static/go.png b/samples/django_sample/static/go.png
deleted file mode 100644
index e5aacda..0000000
--- a/samples/django_sample/static/go.png
+++ /dev/null
Binary files differ
diff --git a/samples/django_sample/templates/plus/login.html b/samples/django_sample/templates/plus/login.html
deleted file mode 100644
index 28a64f1..0000000
--- a/samples/django_sample/templates/plus/login.html
+++ /dev/null
@@ -1,23 +0,0 @@
-{% block content %}
-
-{% if form.errors %}
-<p>Your username and password didn't match. Please try again.</p>
-{% endif %}
-
-<form method="post" action="{% url django.contrib.auth.views.login %}">{% csrf_token %}
-<table>
-<tr>
- <td>{{ form.username.label_tag }}</td>
- <td>{{ form.username }}</td>
-</tr>
-<tr>
- <td>{{ form.password.label_tag }}</td>
- <td>{{ form.password }}</td>
-</tr>
-</table>
-
-<input type="submit" value="login" />
-<input type="hidden" name="next" value="{{ next }}" />
-</form>
-
-{% endblock %}
diff --git a/samples/django_sample/templates/plus/welcome.html b/samples/django_sample/templates/plus/welcome.html
deleted file mode 100644
index d43698b..0000000
--- a/samples/django_sample/templates/plus/welcome.html
+++ /dev/null
@@ -1,17 +0,0 @@
-
-<html>
- <head>
- <title>Your Google+ Activity</title>
- <style type=text/css>
- td { vertical-align: top; padding: 0.5em }
- img { border:0 }
- </style>
- </head>
- <body>
- <table border=1>
- {% for item in activitylist.items %}
- <tr><td>{{ item.object.content|safe }}</td></tr>
- {% endfor %}
- </table>
- </body>
-</html>
diff --git a/samples/django_sample/urls.py b/samples/django_sample/urls.py
deleted file mode 100644
index 4c67ff2..0000000
--- a/samples/django_sample/urls.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import os
-from django.conf.urls.defaults import *
-
-# Uncomment the next two lines to enable the admin:
-from django.contrib import admin
-admin.autodiscover()
-
-urlpatterns = patterns('',
- # Example:
- (r'^$', 'django_sample.plus.views.index'),
- (r'^oauth2callback', 'django_sample.plus.views.auth_return'),
-
- # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
- # to INSTALLED_APPS to enable admin documentation:
- # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
-
- # Uncomment the next line to enable the admin:
- (r'^admin/', include(admin.site.urls)),
- (r'^accounts/login/$', 'django.contrib.auth.views.login',
- {'template_name': 'plus/login.html'}),
-
- (r'^static/(?P<path>.*)$', 'django.views.static.serve',
- {'document_root': os.path.join(os.path.dirname(__file__), 'static')
-}),
-)