Django - 两个项目使用相同的数据库?
我正在我的荣誉协会的网站上工作,我想知道是否 (1.) 两个网站(Django 项目)可以指向同一个数据库,以及 (2.) 这是否是一个好的做法。
背景信息:目前只有一个网站,其用户仅限会员。对于我们的行业关系部分(我们现在正在开发),我们希望公司能够登录以请求信息会议、简历等。目前的情况使得很难引入新类型的用户(在本例中为公司)。所以我想最好将公司方面的事情与一个新网站脱钩,让那里的用户严格针对公司。但该网站仍然需要访问我们主网站上的信息,因此我们正在考虑使其指向同一个数据库。
欢迎任何其他建议! :)
I'm working on my honor society's website, and I'm wondering if (1.) can two websites (Django projects) point to the same database, and (2.) if that's good practice.
Background info: Currently there's only one website, and the users for it are for only for members. For our industry relations part (which we are developing now), we want to have companies be able to log in for things like requesting information sessions, resumes, etc. The way things are right now makes it difficult to introduce a new type of user (in this case, the companies). So I was thinking it'd be better to decouple the company side of things to a new website, making the users there strictly for companies. But this website would still need access to the info on our main site, so we were thinking of making it point to the same database.
Any other suggestions are welcome! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这很容易做到。只需设置文件中相同的数据库详细信息即可。
它可以合理地用于..
唯一的缺点可能是跟踪管理/用户功能,但这并不是一个大问题
It can quite easily be done. Just a matter of the same database details in the settings file.
It could reasonably be used for..
The only disadvantages may be in keeping track of administration/user functionality but thats not a big one
我确实相信 Django 数据库中的每个应用程序都有其以 appname_ 开头的表。你是这个意思吗?
I do believe that every app in Django's DB has its tables prepended by appname_. Is that what you mean?
很常见。像这样的技术很常见,用于避免冗余数据,这通常是一件坏事。否则有人(或一些丑陋的程序)最终会试图让它们保持同步。
Very common. Techniques like this are common for avoiding redundant data, which is usually a bad thing. Otherwise someone (or some ugly program) ends up trying to keep them in sync.