Prepare the Django Project

by John Samuel Anderson last modified Jul 02, 2010 02:15 PM
Configure a new django project and server.

Setup a fresh Django project

  1. Install Django.  (This is beyond the scope of this document.)
  2. Create a new Django project.
    django-admin.py startproject mydjangoproject
    cd mydjangoproject
  3. The rest of these commands happen inside the "mydjangoproject" Django project directory.

  4. Configure the settings.py file to point to the PostgreSQL database.
    DATABASE_ENGINE = 'postgresql_psycopg2'  # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
    DATABASE_NAME = 'mydatabase'             # Or path to database file if using sqlite3.
    DATABASE_USER = 'myuseraccount'          # Not used with sqlite3.
    DATABASE_PASSWORD = 'mypassword'         # Not used with sqlite3.
    
  5. Do Django's syncdb so your PostgreSQL database has the Django minimum tables.
    python manage.py syncdb