_ _ _ _ _ _ _
__| |(_)__ _ _ _ __ _ ___ _ __ _ _ ___ (_)___ __| |_ | |_ ___ _ __ _ __| |__ _| |_ ___
/ _` || / _` | ' \/ _` / _ \ | '_ \ '_/ _ \| / -_) _| _| | _/ -_) ' \| '_ \ / _` | _/ -_)
\__,_|/ \__,_|_||_\__, \___/ | .__/_| \___// \___\__|\__| \__\___|_|_|_| .__/_\__,_|\__\___|
|__/ |___/ |_| |__/ |_|
A custom template for initializing a new Django project the Data Desk way.
Uses the built-in Django startproject
templating system. Includes a number of small modifications favored by the Los Angeles Times Data Desk. Assumes you already have experience hacking around on Django and PostGIS.
Still experimental, so don't get your hopes up.
- Issues: https://github.com/datadesk/django-project-template/issues
- Testing: https://travis-ci.org/datadesk/django-project-template
- Coverage: https://coveralls.io/r/datadesk/django-project-template
- A split of
settings.py
that allows for different values in development versus production - Preinstallation of Django's automatic administration panel
- Preconfiguration of urls.py to serve static, media and Munin files
- Preconfiguration of logging options
- Preconfiguration of GeoDjango for PostGIS
- Preinstallation of django-debug-toolbar
- Preinstallation of django-greeking
- Fabric functions for local development and production deployment
- Preinstallation of tools for interacting with Amazon Web Services
- Preconfiguration of New Relic server and Python monitoring services
- Preconfiguration of our preferred caching options for development and production
- Chef cookbook with scripted production server configuration routines
- Management commands for scheduling database backups to be stored in a bucket on Amazon S3 and retrieving them for local installation.
- Custom context processors that provide the current site and environment.
- A number of goofball utilities, like a unicode CSV reader
Create a virtual enviroment to work inside.
$ virtualenv my-environment
Jump in and turn it on.
$ cd my-environment
$ . bin/activate
Install Django.
$ pip install django
Create a new Git repository.
$ git init repo
Download and install a project in there using this template.
$ django-admin.py startproject --extension=py,.gitignore --template=https://github.com/datadesk/django-project-template/archive/master.zip project repo
Now that the template has landed, jump in and install the project's Python dependencies.
$ cd repo
$ pip install -r requirements.txt
Generate a secret key.
$ fab makesecret
Copy the key. Open the settings file and drop it near the top. While you're there, you can also customize any of the other top level configuration options.
$ vim project/settings.py
Create a PostGIS database to connect with. This may vary depending on your PostGIS configuration.
The command below assumes you have it running and want to make the database with a user named postgres
. Please modify it to suit your needs. If you don't have PostGIS installed, try following the GeoDjango installation instructions.
$ createdb -U postgres -E UTF8 -T template_postgis mydatabasename
Make a copy of the development settings template.
$ cp project/settings_dev.template project/settings_dev.py
Open it and put in the credentials for the database you just made.
$ vim project/settings_dev.py
Sync the database.
$ python manage.py syncdb
Fire up the test server.
$ fab rs
Get to work. Once you have something worth saving you can replace this README with a description of your new project.