pinax account project
This commit is contained in:
parent
086d2d1cc0
commit
0f6843b08d
18 changed files with 447 additions and 0 deletions
8
symposion_project/__init__.py
Normal file
8
symposion_project/__init__.py
Normal file
|
@ -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.
|
||||
"""
|
0
symposion_project/apps/__init__.py
Normal file
0
symposion_project/apps/__init__.py
Normal file
0
symposion_project/apps/about/__init__.py
Normal file
0
symposion_project/apps/about/__init__.py
Normal file
3
symposion_project/apps/about/models.py
Normal file
3
symposion_project/apps/about/models.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.db import models
|
||||
|
||||
# Create your models here.
|
11
symposion_project/apps/about/urls.py
Normal file
11
symposion_project/apps/about/urls.py
Normal file
|
@ -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"),
|
||||
)
|
1
symposion_project/apps/about/views.py
Normal file
1
symposion_project/apps/about/views.py
Normal file
|
@ -0,0 +1 @@
|
|||
# Create your views here.
|
10
symposion_project/fixtures/initial_data.json
Normal file
10
symposion_project/fixtures/initial_data.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
[
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "sites.site",
|
||||
"fields": {
|
||||
"domain": "example.com",
|
||||
"name": "example.com"
|
||||
}
|
||||
}
|
||||
]
|
20
symposion_project/manage.py
Executable file
20
symposion_project/manage.py
Executable file
|
@ -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()
|
25
symposion_project/requirements/base.txt
Normal file
25
symposion_project/requirements/base.txt
Normal file
|
@ -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
|
7
symposion_project/requirements/project.txt
Normal file
7
symposion_project/requirements/project.txt
Normal file
|
@ -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.
|
204
symposion_project/settings.py
Normal file
204
symposion_project/settings.py
Normal file
|
@ -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 <URL> 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
|
13
symposion_project/static/README
Normal file
13
symposion_project/static/README
Normal file
|
@ -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.
|
4
symposion_project/templates/_footer.html
Normal file
4
symposion_project/templates/_footer.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
{% load i18n %}
|
||||
<div class="legal">
|
||||
{% trans "© 2012 <your company here>" %}
|
||||
</div>
|
38
symposion_project/templates/about/what_next.html
Normal file
38
symposion_project/templates/about/what_next.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
{% extends "site_base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% load ifsetting_tag %}
|
||||
|
||||
{% block head_title %}{% trans "What Next?" %}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>{% trans "What Next?" %}</h1>
|
||||
|
||||
{% if user.is_authenticated %}
|
||||
<p>Here are some things to do to get started with this site:</p>
|
||||
|
||||
<dl class="what_next">
|
||||
<dt><a href="{% url acct_email %}">verify an email address</a></dt>
|
||||
<dd>so you can receive notifications, reset your password and so people can find you more easily.</dd>
|
||||
|
||||
{% ifsetting ACCOUNT_OPEN_SIGNUP %}
|
||||
{% else %}
|
||||
{% if user.is_staff %}
|
||||
<dt><a href="{% url admin_invite_user %}">invite more people to the site</a> [admin only]</dt>
|
||||
<dd>so more people can share in the fun.</dd>
|
||||
{% endif %}
|
||||
{% endifsetting %}
|
||||
</dl>
|
||||
{% else %}
|
||||
{% url acct_login as login_url %}
|
||||
|
||||
<p class="what_next">
|
||||
{% ifsetting ACCOUNT_OPEN_SIGNUP %}
|
||||
{% url acct_signup as signup_url %}
|
||||
{% blocktrans %}Start by <a href="{{ signup_url }}">signing up</a> and <a href="{{ login_url }}">logging in</a>.{% endblocktrans %}
|
||||
{% else %}
|
||||
{% blocktrans %}Start by <a href="{{ login_url }}">logging in</a>.{% endblocktrans %}
|
||||
{% endifsetting %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
44
symposion_project/templates/homepage.html
Normal file
44
symposion_project/templates/homepage.html
Normal file
|
@ -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 %}
|
||||
<h1>{% trans "Welcome to Pinax" %}</h1>
|
||||
<p>
|
||||
{% blocktrans %}
|
||||
<b>Pinax</b> is a <a href="http://djangoproject.com/">Django</a>
|
||||
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 %}
|
||||
</p>
|
||||
|
||||
<h2>About Account Project</h2>
|
||||
<p>
|
||||
{% 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 %}
|
||||
</p>
|
||||
|
||||
{% if user.is_authenticated %}
|
||||
{% url what_next as what_next_url %}
|
||||
<p class="what_next">{% blocktrans %}Wondering <a href="{{ what_next_url }}" class="btn primary large">What Next</a>?{% endblocktrans %}</p>
|
||||
{% else %}
|
||||
{% url acct_login as login_url %}
|
||||
{% ifsetting ACCOUNT_OPEN_SIGNUP %}
|
||||
{% url acct_signup as signup_url %}
|
||||
<p>{% blocktrans %}You can <a href="{{ login_url }}" class="btn">Log In</a> or <a href="{{ signup_url }}" class="btn primary">Sign Up</a> to try out the site.{% endblocktrans %}</p>
|
||||
{% else %}
|
||||
<p>{% blocktrans %}You can <a href="{{ login_url }}" class="btn primary large">Log In</a> to try out the site.{% endblocktrans %}</p>
|
||||
{% endifsetting %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
19
symposion_project/templates/site_base.html
Normal file
19
symposion_project/templates/site_base.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{% extends "theme_base.html" %}
|
||||
|
||||
{% load metron_tags %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block extra_head_base %}
|
||||
{% block extra_head %}{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
<div class="legal">
|
||||
{% include "_footer.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_body_base %}
|
||||
{% analytics %}
|
||||
{% block extra_body %}{% endblock %}
|
||||
{% endblock %}
|
29
symposion_project/urls.py
Normal file
29
symposion_project/urls.py
Normal file
|
@ -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")),
|
||||
)
|
11
symposion_project/wsgi.py
Normal file
11
symposion_project/wsgi.py
Normal file
|
@ -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()
|
Loading…
Reference in a new issue