Django Tutorial
Setup Database

Updated at 2018-11-23 16:20

Use PostgreSQL as your backend:

echo -e "psycopg2" >>
pip-compile --output-file requirements.txt
pip install -r requirements.txt

# or if it fails on Mac OS X because of homebrew and openssl
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install -r requirements.txt

Edit djangor/

    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'djangor',
        'USER': 'djangor',
        'PASSWORD': '',
        'HOST': 'localhost',
        'PORT': '',
# in reality, some of this stuff should be read from env variables

Create database and try that it works:

createuser djangor -d # we need privileges to create db for tests
createdb -O djangor djangor
python migrate
python runserver