Django PostgreSQL安装和设置

We’ll know that SQLite is very powerful, embedded relational database management system and it offers a really amazing set of tools to manage approximately all sorts of data. But when it comes Multi-user applications (where multiple users want to use the same databases),  It fails. So It is recommended to choose a fully featured relational database management system rather than SQLite.

我们将知道SQLite是非常强大的嵌入式关系数据库管理系统,它提供了一套非常了不起的工具来管理几乎所有类型的数据。 但是,当涉及到多用户应用程序(多个用户希望使用相同的数据库)时,它就会失败。 因此,建议选择功能全面的关系数据库管理系统,而不要选择SQLite。

Some examples of Fully featured RDBMS are MySQL, PostgreSQL, Oracle databases.

功能齐全的RDBMS的一些示例是MySQL,PostgreSQL,Oracle数据库。

Django is very flexible in terms of changing databases.

Django在更改数据库方面非常灵活。

So in this article, we’ll see how we can change the database from SQLite to PostgreSQL.

因此,在本文中,我们将看到如何将数据库从SQLite更改为PostgreSQL。

先决条件 (Prerequisites)

Instead of creating everything from scratch, we’re taking the example of our previous article, in which we’re using SQLite database.

而不是从头开始创建所有内容,我们以上一篇文章为例,其中我们使用SQLite数据库。

If you haven’t read our previous article yet, then here it is https://www.thecrazyprogrammer.com/2019/01/django-models.html

如果您尚未阅读我们的上一篇文章,那么这里是https://www.thecrazyprogrammer.com/2019/01/django-models.html

Let’s start.

开始吧。

步骤1:安装PostgreSQL (Step 1: Install PostgreSQL)

To Install PostgreSQL for Django in Ubuntu:

要在Ubuntu中为Django安装PostgreSQL:

Open terminal and type these two commands.

打开终端并键入这两个命令。

sudo apt-get update

sudo apt-get更新

sudo apt-get install python-pip python-dev libpq-dev postgresql       postgresql-         contrib

须藤apt-get install python-pip python-dev libpq-dev postgresql postgresql- contrib

To Install PostgreSQL for Django in Windows:

要在Windows中为Django安装PostgreSQL:

Download the installer from its official site: 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值