Sep
17
|
Django has been my thing for the past few weeks. It’s been a lot of fun reading the James Bennett’s Practical Django Projects. Unfortunately, on Sept 3, the release of Django v1.0 has made many of the codes not compatible.
The new release of Django has given me a headache while I was trying to setup django-registration. The problem lies in the upgrading of Django to the latest build. The old Django codes cause a problem in setting the app. Thanks to the guys at the Django Channel that helped me out.
So I hope I can help by writing a tutorial for those who needs it. Stone Mind, once wrote a tutorial on django-registration, but it’s out-dated now.
Here it goes:
Prerequisites:
django version 1.0
django-registration version 0.6 (if possible, use the trunk copy)
Step 1, unpack django-registration:
Put the app folder, registration into the project folder. (make sure that your PYTHONPATH is pointing to the project folder). registration folder is the folder that contains __init__.py.
Step 2, setup the application:
Add ‘registration’ into the list of INSTALLED_APPS. For example,
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'registration',
)
Step 3, setup the database:
Run python manage.py syncdb
to populate the tables from the list of applications. Ensure you have filled in the relevant database settings before you run it. Example for sqlite3 database settings,
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'reg.db'
DATABASE_USER = ''
DATABASE_PASSWORD = ''
DATABASE_HOST = ''
DATABASE_PORT = ''
Step 4, setup the url pointer:
Add (r'accounts/', include('registration.urls'))
into the list of URLpatterns. For example,
urlpatterns = patterns('',
(r'^admin/(.*)', admin.site.root),
(r'^accounts/', include('registration.urls')),
)
Step 5, setup the templates:
Setup the template path by adding /path/to/project/templates/ in TEMPLATE_DIRS. Example,
TEMPLATE_DIRS = (
'/Users/mangoorange/Projects/Django/reg/templates/'
)
Step 6, inserting the templates:
This part is actually fairly simple. I have provided a copy of a working project, [download#74#nohits], that you can use. Just add in the django-registration app into the project folder. If you want to learn more about template form, you can check it out here.
Step 7, done:
Sorry to disappoint you. It’s done. 🙂
Feel free to share any feedback and comments on the tutorial. Hope it helps.
Best Wordpress Hosting Providers - 2014
All three hosts offer FREE 1-click Wordpress installs making them the best Wordpress hosting providers. For more web hosting reviews be sure to check out AlreadyHosting.com.
![]() Bluehost Review |
![]() iPage Review |
![]() HostMetro Review |
One Ping to “django-registration tutorial”
6 Responses to “django-registration tutorial”
-
1. mickeyckm Says:
November 6th, 2008 at 8:14 pm@Sergio: You can try using django-profiles to fill in other information.
-
2. bought_the_book Says:
December 27th, 2008 at 5:50 pmI agree — I have all the django books — I went through a lot of headaches only to realize that if you follow the directions and use the latest version of django that a lot of the code that they say works is totally obsolete making the books near worthless —
and if you buy the teach yourself django in 24 hours . . . you’ll be spending a lot more that 24 hours trying to figure out what’s going on and why the tutorials do not work.
-
3. 3cm Says:
January 15th, 2009 at 8:05 amWhere exactly do I place the registration directory?
My application is located in home/webapps/django/myproject/myapp.
Thanks.
-
4. Cody Says:
January 15th, 2009 at 11:14 pmthanks a kabillion
-
5. simon Says:
April 21st, 2009 at 5:21 amMany thanks, works like a dream..
To customise admin templates used by registration checkout this article:
https://www.rkblog.rk.edu.pl/w/p/password-reset-django-10/ -
6. Andrew B. Says:
August 25th, 2009 at 1:53 amThanks! Your templates are a great starting point. I don’t know why django-registration doesn’t include examples.
Leave a Reply
You must be logged in to post a comment.
September 29th, 2009 at 1:54 pm
[…] basic idea is that an anonymous user can create a new account, but cannot login until they activate their […]