For information on how to use this project template, check out the wiki.
You've cloned the repo or started a new project with the startproject command. Here's how you actually get started developing. These steps assume you have pip installed.
-
Install virtualenv.
pip install virtualenv
-
Then, start a virtualenv in the project directory.
$ virtualenv venv $ . venv/bin/activate
-
Install the project requirements.
({{ project_name }}) $ pip install -r requirements.txt # wait for a couple of minutes, hopefully nothing goes wrong!
-
Link the local project settings to local_settings.py.
({{ project_name }}) $ ln -s conf/settings/local.py local_settings.py
-
Create your local database. Make sure you run the steps below if you haven't already installed PostgreSQL.
$ psql postgres# CREATE ROLE {{ project_name }}_local WITH LOGIN ENCRYPTED PASSWORD '{{ project_name }}_local'; postgres# CREATE DATABASE {{ project_name }}_local WITH OWNER {{ project_name }}_local;
Note: If you get a
psql: FATAL: role "YOUR_USERNAME" does not exist
error, just do the following to save yourself from having to write--user postgres
every time you want to runpsql
. If, say, your username isdan
on your development machine, you'd run the following:$ createuser -s dan # Create a superuser named `dan` $ createdb -O dan dan # Create a database for this user to log into.
After doing this, re-run the psql commands in step 5.
-
Make manage.py executable and run migrations.
({{ project_name }}) $ chmod +x manage.py ({{ project_name }}) $ ./manage.py migrate
-
Set up the Git hooks.
$ git_config/configure.sh
-
Start the local development server.
({{ project_name }}) $ ./manage.py runserver Performing system checks... September 17, 2014 Django version 1.9.6, using settings 'settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C.
Map "local.{{ project_name }}.com" to 127.0.0.0 using DNS. If you haven't yet registered a domain, add the following line to your /etc/hosts
file.
127.0.0.1 local.{{ project_name }}.com
After you've done that, open your browser and navigate to "[local.{{ project_name }}.com](http://local.{{ project_name }}.com)". Your project is now running!
If you're on a Mac and have Homebrew installed, we'll keep it simple.
brew install postgresql
If you're in the mood for a longer read or have run into issues, here's a good article on how to install PostgreSQL on your system (covers Mac OS X, Windows, and Ubuntu).