diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..1cfb0a5e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.pyc +.DS_Store +*~ \ No newline at end of file diff --git a/__init__.py b/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/app.yaml b/app.yaml new file mode 100644 index 000000000..b65886121 --- /dev/null +++ b/app.yaml @@ -0,0 +1,31 @@ +application: iacrhelios +version: 1 +runtime: python +api_version: 1 + +default_expiration: '3650d' + +handlers: +- url: /static/auth + static_dir: auth/media + secure: always + +- url: /static/helios + static_dir: helios/media + secure: always + +- url: /static + static_dir: iacr/media + secure: always + +- url: /booth + static_dir: heliosbooth + secure: always + +- url: /verifier + static_dir: heliosverifier + secure: always + +- url: /.* + script: django-gae.py + secure: always diff --git a/django-gae.py b/django-gae.py new file mode 100644 index 000000000..3f207101c --- /dev/null +++ b/django-gae.py @@ -0,0 +1,44 @@ +""" +Running Django on GAE, as per +http://code.google.com/appengine/articles/django.html + +Ben Adida +ben@adida.net +2009-07-11 +""" + +import logging, os + +# Django 1.0 +from google.appengine.dist import use_library +use_library('django', '1.0') + +# Appengine Django Helper +from appengine_django import InstallAppengineHelperForDjango +InstallAppengineHelperForDjango() + +# Google App Engine imports. +from google.appengine.ext.webapp import util + +# Force Django to reload its settings. +from django.conf import settings +settings._target = None + +# Must set this env var before importing any part of Django +os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' + +import logging +import django.core.handlers.wsgi +import django.core.signals +import django.db +import django.dispatch.dispatcher + +def main(): + # Create a Django application for WSGI. + application = django.core.handlers.wsgi.WSGIHandler() + + # Run the WSGI CGI handler with that application. + util.run_wsgi_app(application) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/index.yaml b/index.yaml new file mode 100644 index 000000000..201ea4b61 --- /dev/null +++ b/index.yaml @@ -0,0 +1,23 @@ +indexes: + +- kind: django_admin_log + properties: + - name: content_type + - name: object_id + - name: action_time + +- kind: django_admin_log + properties: + - name: user + - name: action_time + direction: desc + +# AUTOGENERATED + +# This index.yaml is automatically updated whenever the dev_appserver +# detects that a new type of query is run. If you want to manage the +# index.yaml file manually, remove the above marker line (the line +# saying "# AUTOGENERATED"). If you want to manage some indexes +# manually, move them above the marker line. The index.yaml file is +# automatically uploaded to the admin console when you next deploy +# your application using appcfg.py. diff --git a/manage.py b/manage.py new file mode 100644 index 000000000..57352cc9e --- /dev/null +++ b/manage.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# Copyright 2008 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from appengine_django import InstallAppengineHelperForDjango +InstallAppengineHelperForDjango() + +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.\nYou'll have to run django-admin.py, passing it your settings module.\n(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/settings.py b/settings.py new file mode 100644 index 000000000..cd44a9e85 --- /dev/null +++ b/settings.py @@ -0,0 +1,128 @@ +# Copyright 2008 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Django settings for google-app-engine-django project. + +import os + +DEBUG = True +TEMPLATE_DEBUG = DEBUG + +ADMINS = ( + # ('Your Name', 'your_email@domain.com'), +) + +MANAGERS = ADMINS + +DATABASE_ENGINE = 'appengine' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. +DATABASE_NAME = '' # Or path to database file if using sqlite3. +DATABASE_USER = '' # Not used with sqlite3. +DATABASE_PASSWORD = '' # Not used with sqlite3. +DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. +DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. + +# 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 = 'UTC' + +# 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 = 'hvhxfm5u=^*v&doo#oq8x*eg8+1&9sxbye@=umutgn^t_sg_nx' + +# Ensure that email is not sent via SMTP by default to match the standard App +# Engine SDK behaviour. If you want to sent email via SMTP then add the name of +# your mailserver here. +EMAIL_HOST = '' + +# List of callables that know how to import templates from various sources. +TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.load_template_source', + 'django.template.loaders.app_directories.load_template_source', +# 'django.template.loaders.eggs.load_template_source', +) + +MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', +# 'django.contrib.auth.middleware.AuthenticationMiddleware', +# 'django.middleware.doc.XViewMiddleware', +) + +TEMPLATE_CONTEXT_PROCESSORS = ( +# 'django.core.context_processors.auth', + 'django.core.context_processors.debug', + 'django.core.context_processors.i18n', +# 'django.core.context_processors.media', # 0.97 only. +# 'django.core.context_processors.request', +) + +ROOT_URLCONF = 'urls' + +ROOT_PATH = os.path.dirname(__file__) +TEMPLATE_DIRS = ( + ROOT_PATH, + os.path.join(ROOT_PATH, 'templates') +) + + +# Change your email settings +DEFAULT_FROM_EMAIL = 'ben@adida.net' +SERVER_EMAIL = DEFAULT_FROM_EMAIL + +# Make this unique, and don't share it with anybody. +SECRET_KEY = 'votweerulez!!!ohyeah,andheliostoo' + +#LOGIN_URL = '/account/login/' +#LOGOUT_URL = '/account/logout/' +#LOGIN_REDIRECT_URL = '/' + +INSTALLED_APPS = ( + 'appengine_django', + 'auth', + 'helios', + 'votwee', +) + + +APPEND_SLASH = False +DEBUG = True +TEMPLATE_DEBUG = True + +URL_HOST = "http://votwee.com" \ No newline at end of file diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 000000000..281fe9caf --- /dev/null +++ b/templates/404.html @@ -0,0 +1,6 @@ +{% extends 'base.html' %} +{% block title %}Page not found{% endblock %} + +{% block content %} +The page you requested could not be found. +{% endblock %} diff --git a/templates/500.html b/templates/500.html new file mode 100644 index 000000000..ea97b712a --- /dev/null +++ b/templates/500.html @@ -0,0 +1,6 @@ +{% extends 'base.html' %} +{% block title %}Server error{% endblock %} + +{% block content %} +There was an error while handling your request. +{% endblock %} diff --git a/urls.py b/urls.py new file mode 100644 index 000000000..62387888e --- /dev/null +++ b/urls.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +from django.conf.urls.defaults import * +from django.contrib import admin + +urlpatterns = patterns('', + (r'^auth/', include('auth.urls')), + (r'^helios/', include('helios.urls')), + (r'^', include('votwee.urls')), + + # static hack -- production should bypass this route + #(r'^static/helios/(?P.*)$', 'django.views.static.serve', + # {'document_root': '/web/votwee/helios/media/helios/'}), +) \ No newline at end of file