如何以低廉的成本托管 Django 网站?

How to host a Django website inexpensively?

我最近一直在开发错误跟踪软件,我的客户希望网站尽快 运行 上线。我正在为数据库使用内置的 SQLite。

我想不通的是,如何尽可能便宜地托管它,以及我能否将 SQLite 用作生产数据库。

这是一个非常小的网站 运行,位于 Django 的管理部分,根据客户告诉我的情况,用户数量非常少。我读过如果数据库会很大,我应该选择 MySQL 或 MongoDB 或任何其他数据库系统,但正如我之前提到的,不一定非得如此很多用户。

AWS 是一个不错的选择吗?如果是的话,我要花多少钱才能把它弄起来运行。

公认的 SQLite 速度慢的建议是错误的。来自 the website:

SQLite works great as the database engine for most low to medium traffic websites (which is to say, most websites). The amount of web traffic that SQLite can handle depends on how heavily the website uses its database. Generally speaking, any site that gets fewer than 100K hits/day should work fine with SQLite. The 100K hits/day figure is a conservative estimate, not a hard upper bound. SQLite has been demonstrated to work with 10 times that amount of traffic.

确保文件位于良好的 SSD 驱动器上,从速度的角度来看你会没问题。

但是,并发性可能是个问题。考虑这个建议(来自同一页面):

If there are many client programs sending SQL to the same database over a network, then use a client/server database engine instead of SQLite. SQLite will work over a network filesystem, but because of the latency associated with most network filesystems, performance will not be great. Also, file locking logic is buggy in many network filesystem implementations (on both Unix and Windows). If file locking does not work correctly, two or more clients might try to modify the same part of the same database at the same time, resulting in corruption. Because this problem results from bugs in the underlying filesystem implementation, there is nothing SQLite can do to prevent it.

如果您确实使用 SQLite,请确保您有一个每日(或每小时)备份系统,以便您的客户端可以在需要时回滚到较早的版本。考虑到上述建议,将文件存储在本地而不是通过网络访问它可能是个好主意。

请记住,所有数据库系统都可能遭受损坏,并且它们都需要备份策略。