This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Benjamin Golub (author)
Wed Jun 24 06:23:19 -0700 2009
fftogo / django_ae_utils
| name | age | message | |
|---|---|---|---|
| .. | |||
| |
.svn/ | ||
| |
CHANGELOG | ||
| |
COPYING | ||
| |
README | ||
| |
__init__.py | ||
| |
__init__.pyc | ||
| |
auth/ | ||
| |
sessions/ |
django_ae_utils/README
Django App Engine Utilities =========================== Django technically runs on Google App Engine but there are significant parts which do not work too well. Django App Engine Utilities is a collection of tools to replace or supplement these parts creates in Django. Get more info as well as the latest version of Django App Engine Utilities at http://code.google.com/p/django-ae-utils/. What django-ae-utils provides right now --------------------------------------- * A session engine which uses the App Engine Datastore for a backend. * A user model which uses the App Engine Datastore for a backend (includes generic views for register, login, and logout). What django-ae-utils may include in the future ---------------------------------------------- * What ever else is found to be needed with further experimentation and development with App Engine. Using the django-ae-utitls session engine ----------------------------------------- * Add the django_ae_utils directory to your project directory or somewhere else along your PYTHON_PATH. * In your settings.py file: - Add 'django.contrib.sessions.middleware.SessionMiddleware' to MIDDLEWARE_CLASSES - Add 'django.contrib.sessions' to INSTALLED_APPS - Set SESSION_ENGINE to 'django_ae_utils.sessions.backends.datastore' * Now just use the sessions as you would in any django app. See http://www.djangoproject.com/documentation/sessions/ for more information about Django Sessions. Using the django-ae-utils User Model ------------------------------------ * Add the django_ae_utils directory to your project directory or somewhere else along your PYTHON_PATH. * Import the user model into your code with the following line: from django_ae_utils.auth.models import User User Model API -------------- * Model attributes: * email - The user's email address * password - The user's hashed password. This should always be set using the set_password method. * first_name - The user's first name * last_name - The user's last name * last_login - A datetime representation of the last time the user logged in * created - A datatime representation of when the user registerd * modified - A datetime representation of when the user was last modified * Model methods: * login (email, password, request) - Verifies the user's credentials against the database and updates the user's last logged in date. Request is an optional argument, if passed login will also store the User in Request.session['user']. * authenticate (email, password) - Verifies the user's credentials against the datastore. * set_password (password) - Accepts a clear-text password, hashes the password, and updates the user model. Using User Model Generic Views ------------------------------ django-ae-utils auth module includes three generic views: register, login, and logout. To use any of the generic views add an entry to your urls.py similar to: (r'^login/$', 'django_ae_utils.auth.views.login'), Additionally the django-ae-utils auth generic views can accept optional parameters to customize their behavior. The available parameters and their defaults are: * login - template="login.html", next_url="/" * logout - next_url="/" * register - template="register.html", next_url="/" To set these parameters use a line in urls.py similar to: (r'^login/$', 'django_ae_utils.auth.views.login', {"template":"my_login.html", "next_url":"/login_success/"), The "next_url" parameter can also be passed via a get or post variable named "next_url". If set, the GET or POST variable will take precedence over any value passed in from urls.py. Finally below are example templates for the login and register views: login.html ---------- <html> <head> <title>Login</title> </head> <body> <h1>Login</h1> {% if feedback %} <div class="feedback"> {{ feedback }} </div> {% endif %} <form action="{{ action_url }}" method="post"> <table class="login_form"> {{ form }} </table> <input type="submit" /> </form> </body> </html> register.html ------------- <html> <head> <title>Register</title> </head> <body> <h1>Register</h1> {% if feedback %} <div class="feedback"> {{ feedback }} </div> {% endif %} <form action="{{ action_url }}" method="post"> <table class="reg_form"> {{ form }} </table> <input type="submit" /> </form> </body> </html> Random Note ----------- Eventually some of the code in this project may make sense to add to the Google App Engine Helper for Django (http://code.google.com/p/google-app-engine-django/). Right now how ever I am simply creating tools as I need them and making them available to anybody else who may also find them useful.








