Django Requirements 2012-08-15
A little over three months ago I blogged about my preferred requirements list. It's now nearly the eve of Django Dash, and I feel it's time to update the list. I'm going to bump the versions on some of the existing packages and add some new ones to the list.
Want to use Django Class Based Views but unhappy with the missing
SelectRelatedMixin, and even
StaffuserRequiredMixin? Not to worry, as this library will make Django
CBVs 134% easier to use.
Django is rather secure, but there is a checklist of things that the security experts want you to do. Save yourself forgetting something and use this library to do all those little things.
Have you ever used the django-debug-toolbar and noticed that you did
request.user.get_profile() call a dozen times? Ever want to
just call that once? This library, by yours truly, resolves the issue.
It loads the user's profile object once, and then passes it down the
If you need sessions, forms, templates, and relational database models, then I can argue you've got the ideal Django project. Make certain you are running the latest Django version (1.4.1). If you have any reason to stick to the Django 1.3 series, I advise bumping it up to Django 1.3.2.
This is the database connector to PostgreSQL, which is what you should be using. Django is known for playing 'nicer' with PostgreSQL than say... MySQL.
Because not using this tool is insane.
Because amongst other things this library gives you, I never want to
write my own
TimeStampedModel ever again. :-)
Django gives you the freedom to migrate data in the way you want. The way I want to do it is via South.
The common go-to tool for non-Social registration.
This is a very solid tool, but you do have to make your own templates or find someone's fork that has a copy of templates that match.
Want to authenticate via Twitter, Facebook, or GitHub? Then use this very useful package.
An excellent tool for making your forms HTML5-ish out of the box. It allows full control of form rendering in the templates.
The child of my own django-uni-forms, this will let me create forms using div-based controls super fast, and do layout customizations if I need them.
This tool makes getting the PostGreSQL settings out of Heroku trivial.
This tool makes getting the memcache settings for Heroku trivial.
All the cool kids who play in devops swear by Gunicorn.
Installing the above packages
Never copy/paste these libraries directly into your projects. Do it the right way: use proper Python dependency management.
requirements.txt file and install them as proper
dependencies. The file should contain the following text:
Django==1.4.1 South==0.7.5 django-braces==0.1.3 django-crispy-forms==1.1.4 django-debug-toolbar==0.9.4 django-extensions==0.8 django-floppyforms==1.0 django-social-auth==0.7.4 django-heroku-memcacheify==0.3 django-heroku-postgresify==0.2 django-profiletools==0.1.3 django-registration==0.8.0 django-secure==0.1.2 gunicorn==0.14.2 psycopg2==2.4.5
Once you have that, you install them thus in your virtualenv:
pip install -r requirements.txt
Now that I have all this, it's time to code!
Tags: python django setup