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:
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:
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:
(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.
One Ping to “django-registration tutorial”
6 Responses to “django-registration tutorial”
Leave a Reply
You must be logged in to post a comment.