项目作者: Alexmhack

项目描述 :
using postgresql database with django
高级语言: JavaScript
项目地址: git://github.com/Alexmhack/django_postgresql.git
创建时间: 2018-08-08T11:39:39Z
项目社区:https://github.com/Alexmhack/django_postgresql

开源协议:

下载


django_postgresql

using postgresql database with django

INSTALLATION

Install the postgresql database in your local computer first from the .exe file on the offical site.

Install the postgresql package for python - psycopg2 using pip in virtualenv

CONFIGURE

Create a new virtualenv and then install all the dependencies for our project there

Create a new django project

Create a new database using the postgresql command line.

CREATE DATABASE blog

Inside our django project settings.py, set the database as the postgresql like so,

  1. 'default': {
  2. 'ENGINE': 'django.db.backends.postgresql',
  3. 'NAME': 'blog',
  4. 'USER': 'postgres',
  5. 'PASSWORD': 'admin',
  6. 'HOST': 'localhost',
  7. 'PORT': '',
  8. }

DJANGO USAGE

Just create models and run makemigrations and migrate command, the new database should work fine.