Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
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

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

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.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda