Installation¶
Requirements¶
- Django 1.6+
- Postgres or MySQL
- Django Admin -
django.contrib.admin
- Humanize -
django.contrib.humanize
Note
Django Name is intended to be installed within a Django project. If you are unfamiliar with Django, check out the docs.
Installation¶
Install the package from PyPI.
$ pip install django-name
Add
name
to yourINSTALLED_APPS
. Be sure to adddjango.contrib.admin
anddjango.contrib.humanize
if they are not already present.INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.humanize', # ... 'name', )
Configure the context processors.
For Django 1.6 and 1.7
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS TEMPLATE_CONTEXT_PROCESSORS += ( 'django.core.context_processors.request', 'name.context_processors.name' )
For Django 1.8+
TEMPLATES = [ { 'BACKEND': '...', 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.request', 'name.context_processors.name' ], # ... }, }, ]
Note
The request
context processor is required by the Name app. The built-in templates require access to request parameters.
The name
processor enables the filter component of the search action as well as some optional branding (see Branding).
Include the URLs.
urlpatterns = [ # ... url(r'^name/', include('name.urls', namespace='name')) ]
Migrate/Sync the database.
Django 1.7+ Migrations¶
Run the migrations.
$ ./manage.py migrate name
Note
If using Django 1.6, see Django 1.6 Migrations.
Django 1.6 Migrations¶
Django Name includes migrations that are compatible with South >= 1.0. Skip to step 3 if South is already installed.
Install South.
INSTALLED_APPS = [ # ... south ]
Sync the database.
$ ./manage.py syncdb
Run the migrations.
$ ./manage.py migrate name
Load the Identifier Type fixtures. (Optional)
$ ./manage.py loaddata identifier_types
Note
To opt out of migrations for Django 1.6, do not install south, and just run $ ./manage.py syncdb
Loading Fixtures¶
Note
This is an optional installation step.
The app comes with a fixture of predefined Indentifier Types. Issue one of the following commands below install them.
# Django 1.7+
$ ./manage.py loaddata --app name identifier_types
# Django 1.6
$ ./manage.py loaddata identifier_types