Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

292
Visualizações
Django user registration and authentication to mutiple databases

I'm looking for a way to register and authenticate custom users accross mutiple databases using Django and postgreSQL.

The application will be cross countries (still brainstorming). Regarding the different laws we need to store the users details inside their own country. For exemple, US users must have data stored in the US, Canadians users stored in Canada and Europeans users stored in Europe.

The problem is that Django (1.11) doesn’t currently provide any support for foreign key or many-to-many relationships spanning multiple databases.

So I came up with 2 options at the moment but I can't see the perfect one. I'm asking if you would have a better solution.

  • Option 1: using postgres_fdw (PostgreSQL foreign data wrapper) Manually creating localized (us, can, euro) databases to store users’ details https://www.postgresql.org/docs/9.6/static/postgres-fdw.html

Then integrate Django with a legacy database

Pros: Supports foreign database relationships

Cons: Manual migration, manual integration, custom scripts.

  • Option 2 : Skip Django referential integrity https://gist.github.com/gcko/de1383080e9f8fb7d208

Pros: Easier Django integration

Cons: Risk of data corruption. I would avoid it!!

Thanks

Django: 1.11

PostgreSQL 9.6

Python 3

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I can think of two other options:

  1. Make authentication external to your application. Django and RESTful systems are inherently modular. Your system does not need to serve application content and authentication from the same Django instance nor do you even need to use Django to authenticate. In fact, given your requirements, I would be inclined to offload authentication to a reliable, third-party service such as Google's service. By using a third party service, you outsource compliance/regulatory concerns that might not be relevant to your early development. For the instance of Google, there are lots of discussions. One on SO is at How to sign in with the Google+ API using Django? There are also Facebook and other authentication options.

  2. Customize the authentication provided by Django. I would start at https://docs.djangoproject.com/en/1.11/topics/auth/customizing/

After posting, it occurs to me that you might be concerned about two different problems:

  • (a) storing authentication, personal data in the correct country
  • (b) storing all user data in the user's country

The answer really applies to a. If you need to store all user data in the user's country, then outsourcing authentication is not a sufficient solution.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda