Setup configuration for the Django database

Source: Internet
Author: User
Tags postgresql virtualenv

What databases does Django support for the setup of the Django database


Can be viewed here, support postgresql,mysql, and so on.

Installing the PostgreSQL database

Address: https://www.postgresql.org/
Normal installation.

Installing PSYCOPG2

PSYCOPG2 is the bridge between Python and PostgreSQL.
Window Address: http://www.stickpeople.com/projects/python/win-psycopg/

C:\> C:\virtualenv\Scripts\activate.bat(virtualenv) C:\> easy_install psycopg2-2.6.2.win32-py2.7-pg9.5.3-release.exe
Configuration of the database

As we use PostgreSQL, we put Settings.py's

DATABASES = {    ‘default‘: {        ‘ENGINE‘: ‘django.db.backends.sqlite3‘,        ‘NAME‘: ‘mydatabase‘,    }}

Change into

DATABASES = {    ‘default‘: {        ‘ENGINE‘: ‘django.db.backends.postgresql‘,        ‘NAME‘: ‘mydatabase‘,        ‘USER‘: ‘mydatabaseuser‘,        ‘PASSWORD‘: ‘mypassword‘,        ‘HOST‘: ‘127.0.0.1‘,        ‘PORT‘: ‘5432‘,    }}

Here the name is written to create the database:

User write:

Password write: Install PostgreSQL password for this software setting
The rest of the above is consistent with the above.



From for notes (Wiz)

Setup configuration for the Django database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.