These are chat archives for django/django

Sep 2018
Philip Mutua
Sep 24 2018 09:50

Hi everyone,I have two django REST API projects which I have decoupled them into micro services architecture, one of the services is an (SSO) that handles authentication (I'm using JWT token based authentication) and manage Users info and the other is a payroll service.

The problem is the user has a relation to some model in payroll service. To be specific I have an Employee class in payroll service which has a user_id field. This is where I will add a user UUID which I will get from querying the SSO service.

How do I share database across micro-services taking into consideration each service has its own database.

Tanveer Ahmed
Sep 24 2018 11:14
Please Help Me Here
Christoph B├╝lter
Sep 24 2018 12:36
@tanveerobjects_twitter I assume django gets confused, since both URLs start with a very dynamic parameter: how should django know if https://localhost/foobar is a <slug:category_slug> or a <username>? it could be both, so it's matching on the first URL. you can try to simply make it less ambiguous e.g. with a prefix like path('category/<slug:category_slug>/' and path('user/<username>/'
Alexei Znamensky
Sep 24 2018 21:12
for the sake of precision (and nit picking), it's not that django gets "confused" - it simply has no way to tell, in advance, what that URI is. Hence, it defaults to using the first one. @tanveerobjects_twitter you should use Christopher's suggestion to fix this ambiguity.
Chris Smith
Sep 24 2018 22:16
Is there any way to use the html <style> tag in a Django html template vs. having to use <div>?
Correction, <select> tag instead of <div>.
I am using MDBootstrap and the way I need to call my Django objects for use in a POST form is breaking my css and js.