简体   繁体   English

从多个应用程序使用Django身份验证系统

[英]Use django authentication system from multiple apps

I am developing django base web service now and I am confused. 我现在正在开发django基本Web服务,我很困惑。

I have three projects as a django projects. 我有三个项目作为Django项目。

app1 - use from the end user app1-最终用户使用

app2 - use from the service providor app2-从服务提供者使用

app3 - use from the operator(administrator) app3-由操作员(管理员)使用

I made one database from app3(migration) and I created symbolic links (models.py, migrations dir) to app1 and app2. 我从app3(migration)建立了一个数据库,并创建了到app1和app2的符号链接(models.py,迁移目录)。

And then I try to use user authentication system of django from my app1, I got a following error. 然后尝试从我的app1使用django的用户身份验证系统,出现以下错误。

The above exception (relation "myapp1_user" does not exist LINE 1: ...myapp1_user"."modify_date" FROM ^ ) was the direct cause of the following exception: 上面的异常(关系“ myapp1_user”不存在第1行:... myapp1_user“。” modify_date“ FROM ^)是以下异常的直接原因:

I know what is wrong. 我知道怎么了 It's because I don't have myapp1_user table on my database. 这是因为我的数据库中没有myapp1_user表。 I only have app3_user table. 我只有app3_user表。

But I have no idea how can I configure to work well. 但是我不知道如何配置才能正常工作。 Does somebody have any idea? 有人有什么主意吗? Please let me know. 请告诉我。

when a user signup to app give there three options end user, service provider, administrator. 当用户注册应用时,会为最终用户,服务提供商和管理员提供三个选项。 take these fields in BooleanField. 将这些字段放在BooleanField中。 so when the user going to sign in then check the true and false for these three user accounts and whichever condition appeaser as true that will be executed. 因此,当用户要登录时,请检查这三个用户帐户的正确与否以及执行条件的任何条件。

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

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