Published onRaise your hand if you never versioned the Django’s SECRET_KEY at the beginning of a project and needed to generate a new one before going to production. This TLDR is a quick reminder of how to generate a secret key locally, without going to some website on the internet to generate it for you. Django generates a secret key every time that you create a new project, so this function already exists at its code, and you can access it in this way:
Published onThis post it the result of a bug that haunted me for three months until I finally could isolate the error properly, and get to the root of the issue. Disclaimer: this information exists at the Django docs, however strengthening the importance of this info is vital to prevent people to spend a lot of time with this kind of bug. One of the core parameters of a Django Model field is the default.
Published onAlmost every system that runs on the internet and stores user data has an authentication layer. With the API architecture becoming popular nowadays, the complexity of the authentication layer also grew. This post was made to explain the authentication process between a frontend written in Angular 6 and a backend written in Django 2 using the architecture proposed on my previous post “Separating Frontend from Backend with Angular and Django”.
Published onDjango’s official documentation nicely covers its generic relationship functionality when you have to make an OneToMany (one-to-many or 1:N) relation, but when you need to implement a generic ManyToMany (many-to-many or N:N) relation, there is not much documentation about it. I recently had to implement an N:N with a generic side, and discovered a library called django-gm2m that was very useful to me in this task, and I will describe here giving tips on how to make this implementation and how to avoid possible headaches.