我正在为同一个客户端构建几个基于Django的Web应用程序。 我想要做的是设置一个身份验证服务器,以便可以在django项目之间共享用户凭据,例如Jan Doe为App-A创建帐户,并且可以使用相同的un和pw登录到App-B。
Django软件包只是有点帮助,因为我无法从软件包描述中看出软件包是否可以帮助我做我想做的事情。
我在这方面非常缺乏经验,所以我甚至不知道我的问题是否合适,但是这里有:
我应该看看django套餐吗? 寻找基于python的auth服务器会更合适吗? 我应该从哪里开始解决这个问题?
I'm in the process of building several Django based web applications for the same client. What I would like to do is set up an authentication server so that user credentials can be shared among django projects e.g. Jan Doe creates account for App-A and can use the same un and pw to log in to App-B.
Django packages is only somewhat helpful as I can't tell from the package descriptions if the package will help me do what I want to do or not.
I'm very inexperienced in this area so I don't even know if my questions are appropriate, but here goes:
Should I even be looking at django packages? Would looking for a python based auth server be more appropriate? Where should I start to solve this problem?
最满意答案
不,您不需要单独的包裹。 只需使用Django的内置多数据库处理。 查看: https : //docs.djangoproject.com/en/dev/topics/db/multi-db/ 。
实质上,您将一个数据库指定为将存储用户数据的数据库,并确保将数据库添加到其他每个项目中。 然后设置一个路由器,检查app_label=='auth'并路由到那些实例的“user”数据库。 文档中有一个例子。
No, you don't need a separate package. Just use Django's built-in multi-database handling. Check out: https://docs.djangoproject.com/en/dev/topics/db/multi-db/.
Essentially, you designate one of your databases as the one that's going to store the user data and make sure that database is added to each of your other projects. Then set up a router that checks for app_label=='auth' and route to the "user" database for those instances. There's an example in the docs.
更多推荐
发布评论