From 0f6843b08dcf3010e037e99f70f87616be591868 2012-02-05 18:53:49 From: James Tauber Date: 2012-02-05 18:53:49 Subject: [PATCH] pinax account project --- diff --git a/symposion_project/__init__.py b/symposion_project/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ccd713a212a47186697aca83c56c9d12f8f2a3a9 --- /dev/null +++ b/symposion_project/__init__.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- + +__about__ = """ +This project takes the zero_project and adds basic account management +functionality such as sign up, log in, password change/reset and email +confirmation. It is a foundation suitable for most sites that have user +accounts. +""" diff --git a/symposion_project/apps/__init__.py b/symposion_project/apps/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/symposion_project/apps/about/__init__.py b/symposion_project/apps/about/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/symposion_project/apps/about/models.py b/symposion_project/apps/about/models.py new file mode 100644 index 0000000000000000000000000000000000000000..71a836239075aa6e6e4ecb700e9c42c95c022d91 --- /dev/null +++ b/symposion_project/apps/about/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/symposion_project/apps/about/urls.py b/symposion_project/apps/about/urls.py new file mode 100644 index 0000000000000000000000000000000000000000..3b5c17ea5d74f6e8c8bc7dd44fb3fa0772f48da8 --- /dev/null +++ b/symposion_project/apps/about/urls.py @@ -0,0 +1,11 @@ +from django.conf.urls.defaults import * +from django.views.generic.simple import direct_to_template + + +urlpatterns = patterns("", + url(r"^$", direct_to_template, {"template": "about/about.html"}, name="about"), + url(r"^terms/$", direct_to_template, {"template": "about/terms.html"}, name="terms"), + url(r"^privacy/$", direct_to_template, {"template": "about/privacy.html"}, name="privacy"), + url(r"^dmca/$", direct_to_template, {"template": "about/dmca.html"}, name="dmca"), + url(r"^what_next/$", direct_to_template, {"template": "about/what_next.html"}, name="what_next"), +) diff --git a/symposion_project/apps/about/views.py b/symposion_project/apps/about/views.py new file mode 100644 index 0000000000000000000000000000000000000000..60f00ef0ef347811e7b0c0921b7fda097acd9fcc --- /dev/null +++ b/symposion_project/apps/about/views.py @@ -0,0 +1 @@ +# Create your views here. diff --git a/symposion_project/fixtures/initial_data.json b/symposion_project/fixtures/initial_data.json new file mode 100644 index 0000000000000000000000000000000000000000..891f3860ca5d4bc796caa0940b6364033beff725 --- /dev/null +++ b/symposion_project/fixtures/initial_data.json @@ -0,0 +1,10 @@ +[ + { + "pk": 1, + "model": "sites.site", + "fields": { + "domain": "example.com", + "name": "example.com" + } + } +] diff --git a/symposion_project/manage.py b/symposion_project/manage.py new file mode 100755 index 0000000000000000000000000000000000000000..378e3b0be3df7c4943a0edb78dc49a6589cc86df --- /dev/null +++ b/symposion_project/manage.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python +import sys + +try: + import pinax +except ImportError: + sys.stderr.write("Error: Can't import Pinax. Make sure you are in a " + "virtual environment that has\nPinax installed.\n") + sys.exit(1) +else: + import pinax.env + +from django.core.management import execute_from_command_line + + +pinax.env.setup_environ(__file__) + + +if __name__ == "__main__": + execute_from_command_line() diff --git a/symposion_project/requirements/base.txt b/symposion_project/requirements/base.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba75d61951963e59a7b23e03d361d88a9ff4a38f --- /dev/null +++ b/symposion_project/requirements/base.txt @@ -0,0 +1,25 @@ +# base.txt is a pip requirements file which describes the necessary +# distributions required to run this project. If you need something that is +# project specific not listed here use project.txt. You can, of course, update +# versions of distributions here if needed. + +--extra-index-url=http://dist.pinaxproject.com/dev/ +--extra-index-url=http://dist.pinaxproject.com/alpha/ +--extra-index-url=http://dist.pinaxproject.com/fresh-start/ + +Django==1.3.1 +Pinax + +django-debug-toolbar==0.9.1 +django-staticfiles==1.1.2 +django_compressor==1.0.1 + +django-mailer==0.2a1 +django-email-confirmation==0.2 +django-timezones==0.2 +pytz==2011n +django-openid==0.3a1 +python-openid==2.2.5 +metron==0.1 + +pinax-theme-bootstrap==0.1.5 diff --git a/symposion_project/requirements/project.txt b/symposion_project/requirements/project.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d8b14854ac2cf325e302c0c5c38a5e2234c6a9e --- /dev/null +++ b/symposion_project/requirements/project.txt @@ -0,0 +1,7 @@ +# project.txt is a pip requirements file which describes the distributions +# required by your project to run. + +--requirement=base.txt + +# Put project-specific requirements here. +# See http://pip-installer.org/requirement-format.html for more information. \ No newline at end of file diff --git a/symposion_project/settings.py b/symposion_project/settings.py new file mode 100644 index 0000000000000000000000000000000000000000..c84b830ae26b260d6cbff2d2a580ff9104212f5f --- /dev/null +++ b/symposion_project/settings.py @@ -0,0 +1,204 @@ +# -*- coding: utf-8 -*- +# Django settings for account project + +import os.path +import posixpath + +PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) + +DEBUG = True +TEMPLATE_DEBUG = DEBUG + +# tells Pinax to serve media through the staticfiles app. +SERVE_MEDIA = DEBUG + +# django-compressor is turned off by default due to deployment overhead for +# most users. See for more information +COMPRESS = False + +INTERNAL_IPS = [ + "127.0.0.1", +] + +ADMINS = [ + # ("Your Name", "your_email@domain.com"), +] + +MANAGERS = ADMINS + +DATABASES = { + "default": { + "ENGINE": "django.db.backends.sqlite3", # Add "postgresql_psycopg2", "postgresql", "mysql", "sqlite3" or "oracle". + "NAME": "dev.db", # Or path to database file if using sqlite3. + "USER": "", # Not used with sqlite3. + "PASSWORD": "", # Not used with sqlite3. + "HOST": "", # Set to empty string for localhost. Not used with sqlite3. + "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 = "US/Eastern" + +# 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 = os.path.join(PROJECT_ROOT, "site_media", "media") + +# 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 = "/site_media/media/" + +# Absolute path to the directory that holds static files like app media. +# Example: "/home/media/media.lawrence.com/apps/" +STATIC_ROOT = os.path.join(PROJECT_ROOT, "site_media", "static") + +# URL that handles the static files like app media. +# Example: "http://media.lawrence.com" +STATIC_URL = "/site_media/static/" + +# Additional directories which hold static files +STATICFILES_DIRS = [ + os.path.join(PROJECT_ROOT, "static"), +] + +STATICFILES_FINDERS = [ + "staticfiles.finders.FileSystemFinder", + "staticfiles.finders.AppDirectoriesFinder", + "staticfiles.finders.LegacyAppDirectoriesFinder", + "compressor.finders.CompressorFinder", +] + +# 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 = posixpath.join(STATIC_URL, "admin/") + +# Subdirectory of COMPRESS_ROOT to store the cached media files in +COMPRESS_OUTPUT_DIR = "cache" + +# Make this unique, and don't share it with anybody. +SECRET_KEY = "8*br)9@fs!4nzg-imfrsst&oa2udy6z-fqtdk0*e5c1=wn)(t3" + +# 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", +] + +MIDDLEWARE_CLASSES = [ + "django.middleware.common.CommonMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", + "django.middleware.csrf.CsrfViewMiddleware", + "django.contrib.auth.middleware.AuthenticationMiddleware", + "django_openid.consumer.SessionConsumer", + "django.contrib.messages.middleware.MessageMiddleware", + "pinax.apps.account.middleware.LocaleMiddleware", + "pinax.middleware.security.HideSensistiveFieldsMiddleware", + "debug_toolbar.middleware.DebugToolbarMiddleware", +] + +ROOT_URLCONF = "symposion_project.urls" + +TEMPLATE_DIRS = [ + os.path.join(PROJECT_ROOT, "templates"), +] + +TEMPLATE_CONTEXT_PROCESSORS = [ + "django.contrib.auth.context_processors.auth", + "django.core.context_processors.debug", + "django.core.context_processors.i18n", + "django.core.context_processors.media", + "django.core.context_processors.request", + "django.contrib.messages.context_processors.messages", + + "staticfiles.context_processors.static", + + "pinax.core.context_processors.pinax_settings", + + "pinax.apps.account.context_processors.account", +] + +INSTALLED_APPS = [ + # Django + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.sites", + "django.contrib.messages", + "django.contrib.humanize", + + "pinax.templatetags", + + # theme + "pinax_theme_bootstrap", + + # external + "staticfiles", + "compressor", + "debug_toolbar", + "mailer", + "django_openid", + "timezones", + "emailconfirmation", + "metron", + + # Pinax + "pinax.apps.account", + "pinax.apps.signup_codes", + + # project + "about", +] + +FIXTURE_DIRS = [ + os.path.join(PROJECT_ROOT, "fixtures"), +] + +MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage" + +EMAIL_BACKEND = "mailer.backend.DbBackend" + +ACCOUNT_OPEN_SIGNUP = True +ACCOUNT_USE_OPENID = False +ACCOUNT_REQUIRED_EMAIL = False +ACCOUNT_EMAIL_VERIFICATION = False +ACCOUNT_EMAIL_AUTHENTICATION = False +ACCOUNT_UNIQUE_EMAIL = EMAIL_CONFIRMATION_UNIQUE_EMAIL = False + +AUTHENTICATION_BACKENDS = [ + "pinax.apps.account.auth_backends.AuthenticationBackend", +] + +LOGIN_URL = "/account/login/" # @@@ any way this can be a url name? +LOGIN_REDIRECT_URLNAME = "what_next" +LOGOUT_REDIRECT_URLNAME = "home" + +EMAIL_CONFIRMATION_DAYS = 2 +EMAIL_DEBUG = DEBUG + +DEBUG_TOOLBAR_CONFIG = { + "INTERCEPT_REDIRECTS": False, +} + +# local_settings.py can be used to override environment-specific settings +# like database and email that differ between development and production. +try: + from local_settings import * +except ImportError: + pass diff --git a/symposion_project/static/README b/symposion_project/static/README new file mode 100644 index 0000000000000000000000000000000000000000..cd444f3c0183ae7dc1f3491b0937cbdbf10c11f2 --- /dev/null +++ b/symposion_project/static/README @@ -0,0 +1,13 @@ +This directory is used to store static assets for your project. User media files +(FileFields/ImageFields) are not stored here. + +The convention for this directory is: + + * css/ — stores CSS files + * js/ — stores Javascript files + * img/ — stores image files + +This directory is accessed at /site_media/static/ in runserver when SERVE_MEDIA +is True. It is built with build_static for production environments. + +See http://pinaxproject.com/docs/dev/media.html for more information. \ No newline at end of file diff --git a/symposion_project/templates/_footer.html b/symposion_project/templates/_footer.html new file mode 100644 index 0000000000000000000000000000000000000000..79a20fd5b75e2d1c89194bb63c17b01d67accaaa --- /dev/null +++ b/symposion_project/templates/_footer.html @@ -0,0 +1,4 @@ +{% load i18n %} + \ No newline at end of file diff --git a/symposion_project/templates/about/what_next.html b/symposion_project/templates/about/what_next.html new file mode 100644 index 0000000000000000000000000000000000000000..6ac3b548f1000a5a5e9b491ae9899065a22337c7 --- /dev/null +++ b/symposion_project/templates/about/what_next.html @@ -0,0 +1,38 @@ +{% extends "site_base.html" %} + +{% load i18n %} +{% load ifsetting_tag %} + +{% block head_title %}{% trans "What Next?" %}{% endblock %} + +{% block body %} +

{% trans "What Next?" %}

+ + {% if user.is_authenticated %} +

Here are some things to do to get started with this site:

+ +
+
verify an email address
+
so you can receive notifications, reset your password and so people can find you more easily.
+ + {% ifsetting ACCOUNT_OPEN_SIGNUP %} + {% else %} + {% if user.is_staff %} +
invite more people to the site [admin only]
+
so more people can share in the fun.
+ {% endif %} + {% endifsetting %} +
+ {% else %} + {% url acct_login as login_url %} + +

+ {% ifsetting ACCOUNT_OPEN_SIGNUP %} + {% url acct_signup as signup_url %} + {% blocktrans %}Start by signing up and logging in.{% endblocktrans %} + {% else %} + {% blocktrans %}Start by logging in.{% endblocktrans %} + {% endifsetting %} +

+ {% endif %} +{% endblock %} diff --git a/symposion_project/templates/homepage.html b/symposion_project/templates/homepage.html new file mode 100644 index 0000000000000000000000000000000000000000..962af38996f133a37cc1b1fec0a465a56b66b96e --- /dev/null +++ b/symposion_project/templates/homepage.html @@ -0,0 +1,44 @@ +{% extends "banner_base.html" %} + +{% load i18n %} +{% load ifsetting_tag %} + +{% block head_title %}{% trans "Welcome" %}{% endblock %} + +{% block body_class %}home{% endblock %} + +{% block banner %} +

{% trans "Welcome to Pinax" %}

+

+ {% blocktrans %} + Pinax is a Django + project intended to provide a starting point for websites. By + integrating numerous reusable Django apps to take care of the + things that many sites have in common, it lets you focus on what + makes your site different. + {% endblocktrans %} +

+ +

About Account Project

+

+ {% blocktrans %} + This project takes the zero_project and adds basic account management + functionality such as sign up, log in, password change/reset and email + confirmation. It is a foundation suitable for most sites that have user + accounts. + {% endblocktrans %} +

+ + {% if user.is_authenticated %} + {% url what_next as what_next_url %} +

{% blocktrans %}Wondering What Next?{% endblocktrans %}

+ {% else %} + {% url acct_login as login_url %} + {% ifsetting ACCOUNT_OPEN_SIGNUP %} + {% url acct_signup as signup_url %} +

{% blocktrans %}You can Log In or Sign Up to try out the site.{% endblocktrans %}

+ {% else %} +

{% blocktrans %}You can Log In to try out the site.{% endblocktrans %}

+ {% endifsetting %} + {% endif %} +{% endblock %} diff --git a/symposion_project/templates/site_base.html b/symposion_project/templates/site_base.html new file mode 100644 index 0000000000000000000000000000000000000000..6c811b8167547e61228949de724322c20ec35005 --- /dev/null +++ b/symposion_project/templates/site_base.html @@ -0,0 +1,19 @@ +{% extends "theme_base.html" %} + +{% load metron_tags %} +{% load i18n %} + +{% block extra_head_base %} + {% block extra_head %}{% endblock %} +{% endblock %} + +{% block footer %} + +{% endblock %} + +{% block extra_body_base %} + {% analytics %} + {% block extra_body %}{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/symposion_project/urls.py b/symposion_project/urls.py new file mode 100644 index 0000000000000000000000000000000000000000..e8feb4b197c67d74c150c09b3ad7897caf416dae --- /dev/null +++ b/symposion_project/urls.py @@ -0,0 +1,29 @@ +from django.conf import settings +from django.conf.urls.defaults import * +from django.views.generic.simple import direct_to_template + +from django.contrib import admin +admin.autodiscover() + +from pinax.apps.account.openid_consumer import PinaxConsumer + + +handler500 = "pinax.views.server_error" + + +urlpatterns = patterns("", + url(r"^$", direct_to_template, { + "template": "homepage.html", + }, name="home"), + url(r"^admin/invite_user/$", "pinax.apps.signup_codes.views.admin_invite_user", name="admin_invite_user"), + url(r"^admin/", include(admin.site.urls)), + url(r"^about/", include("about.urls")), + url(r"^account/", include("pinax.apps.account.urls")), + url(r"^openid/", include(PinaxConsumer().urls)), +) + + +if settings.SERVE_MEDIA: + urlpatterns += patterns("", + url(r"", include("staticfiles.urls")), + ) diff --git a/symposion_project/wsgi.py b/symposion_project/wsgi.py new file mode 100644 index 0000000000000000000000000000000000000000..726e2a7bf5cfcb978afadbdee18347a3ddc8ceeb --- /dev/null +++ b/symposion_project/wsgi.py @@ -0,0 +1,11 @@ +from django.core.handlers.wsgi import WSGIHandler + +import pinax.env + + +# setup the environment for Django and Pinax +pinax.env.setup_environ(__file__) + + +# set application for WSGI processing +application = WSGIHandler() \ No newline at end of file