简体   繁体   English

部署使用PostgreSQL数据库的应用程序

[英]Deploying application that uses a PostgreSQL database

I have created a simple application that refers to a PostgreSQL database on my computer. 我创建了一个简单的应用程序,该应用程序引用了我计算机上的PostgreSQL数据库。 How should I run my application on my friend's computer? 我应该如何在朋友的计算机上运行我的应用程序? He doesn't have the PostgreSQL database on his computer yet. 他的计算机上还没有PostgreSQL数据库。 Should I install PostgreSQL on his computer and create the exact same database on his computer and install my application on his computer? 我应该在他的计算机上安装PostgreSQL并在他的计算机上创建完全相同的数据库,然后在他的计算机上安装我的应用程序吗?

IMHO, this is an architectural and DevOps style question: how to do mutual development on a project, without stepping on each other's toes. 恕我直言,这是一个体系结构和DevOps风格的问题:如何在一个项目上进行相互开发,而又不互相踩脚。 There are many solutions to this, and without more direct knowledge of your setup, we can only guess at what's "best." 许多解决方案,并且在没有更直接了解您的设置的情况下,我们只能猜测什么是“最佳”。

At the end of the day, if your project relies on the DB, then your friend will need an accessible DB. 归根结底,如果您的项目依赖数据库,那么您的朋友将需要一个可访问的数据库。 How you do that is up to you. 您的操作方式取决于您。 Before we go into Postgres-specific solutions, have you considered using a simpler SQLite setup for "just you developers", and then migrating to Postgres when preparing to deploy? 在进入特定于Postgres的解决方案之前,您是否考虑过为“只为您的开发人员”使用更简单的SQLite设置,然后在准备部署时迁移到Postgres? This, for example, is a strategy often used by Django website developers . 例如,这是Django 网站 开发人员经常使用的策略。

If your friend does not "speak databases," I might consider the SQLite approach. 如果您的朋友不“讲数据库”,我可能会考虑使用SQLite方法。 Alternatively, you could put a DB on a shared third computer that you can administrate. 或者,您可以将数据库放在可以管理的共享的第三台计算机上。 Going further, you do not necessarily need to have separate databases, provided what each of you are doing in regards to the DB will not impact each other. 进一步讲,您不必一定要有单独的数据库,只要每个人在数据库方面所做的工作不会互相影响。

In short, this best answer to this question is going to be project and developer specific. 简而言之,这个问题的最佳答案将取决于项目和开发人员。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM