Project template for Django 1.7 + Django REST framework containing things I use and find useful.
Part of it is based on Two Scoops of Django template.
It contains the following things:
- Django REST framework: for writing your API
- django-model-utils: for things like TimestampedModel and other nice things for models
- django-cors-headers: automatically allows CORS on local dev and allows for a whitelist in production
- bcrypt: hash password with bcrypt instead of PBKDF2
There are also goodies on dev and test environments:
- django-debug-toolbar: lots of information on request/response
- ipdb: pdb in ipython. Awesome
- django-extensions: adds some useful management commands
- coverage: measures code coverage
- factory-boy: my library of choice to create objects in tests, I go more into details on my blog
- flake8: for code quality
- mkdocs: for documentation
You will need Postgres installed and the following ones (for ubuntu/debian, for others systems look in your package managers).
$ sudo apt-get install libpq-dev python-dev libffi-dev
Create your virtualenv (examples will use virtualenvwrapper), I will use the name myproject but use your own name.
$ mkdir myproject && cd myproject $ mkvrirtualenv myproject $ pip install django $ django-admin.py startproject myproject --template=https://github.com/Keats/django-drf-template/archive/master.zip $ cd myproject $ pip install -r requirements/local.txt $ python myproject/manage.py migrate
If you want, you can also add a pre-commit flake8 hook to ensure that commit respects it.
$ flake8 --install-hook
By default it will not stop commits because of warning, a quick look at .git/hooks/pre-commit shows that putting an environment variable of FLAKE8_STRICT will stop them.
And with all that, you should be almost good to go. There are a few hardcoded temporary settings that you will want to replace, look for the string 'Ann Onymous' and you should find them.