Posts Tagged with Django

24 Apr 2019, 20:36

Deploy Django Application in Sub Path Using Openshift
The Problem When you are using Openshift, you will be using routes to expose a route from a service. Let’s say you want to expose a path in When you do that for a django application(without any reverse proxy server), it usually becomes a problem, because the sub path does not work well with Django’s urls.

10 Feb 2019, 00:38

Django: Save Unknown Object in Database
Suppose you are dealing with a poorly written API, which returns different type of objects at different scenarios. For example, sometimes it returns a string(ie. abcd), sometimes it returns a list(ie. [1,2,3,4]), or maybe None. Now, you are suppose to save that data, which you can’t predict. As you can’t predict the data type of object, you can’t design your Django Model accordingly.

26 Jan 2019, 14:58

Django: Custom Ordering/Grouping for Model Instances Using Linked List
Linked list is a data structure where each object has points to next. In django, linked list can provide an interesting solution when it comes to custom ordering/grouping issues. Lets think of an example like this: you are making a blog site, and you have made a Post Model like this:

03 Jan 2019, 02:00

Django: Changing User Model in Mid-Project
Every now and then I see some questions pop up in stackoverflow with title: ValueError: Related model ‘app.User’ cannot be resolved This is a very common issue and pops up when the user tries to run the migration. So, lets talk more about what is this problem and how can we solve it.

22 Dec 2018, 02:00

Testing for Django Rest Framework with Factory Boy and Faker
“I’m not a great programmer; I’m just a good programmer with great habits.” ― Kent Beck Test Driven Development - in short TDD is a practice where you write the tests first then the actual code. It makes the code less vulnerable and it makes a testable software rather than writing the software, then test it.

29 Apr 2018, 10:00

Boilerplate For Angular 1.X and Django(Powered by Webpack2, Docker, Yarn, DRF)
Simple and clean boilerplate for using django and angular 1.x togather, with basic structure comes built-in. Tech Stack Python3 Django 1.11.6, Django Rest Framework Webpack 2 JavaScript(ES6)/AngularJS 1.x Yarn Prerequisite Require Yarn. How to install Yarn: Require Docker if you want to use this boiler plate with docker.

24 Feb 2018, 13:32

Deploy Django to Openshift 3 Powered by MySQL and Gunicorn
If you want to use Openshift for deploying Django, you can follow this post and simply do that. You don’t need to learn Kubernetes. We will use docker file only. No other fancy stuff. Also, before starting, I am also hoping you are little bit familiar with Openshift 3 and oc tools.

24 Feb 2017, 18:52

Documentation Of Django Encrypt File
This is no longer maintained. Use it at your own risk. Django Encrypt File is a simple Library which can be used to encrypt uploaded files and store them. Installation Use pip to install it: pip install djangoencryptfile Or pip install Basic Usage from djangoencryptfile import EncryptionService from django.

14 Nov 2016, 15:43

Docker: Use Celery in Django(Redis as Broker)
In previous two posts, we have deployed Django with Postgres, Nginx, now its time to do some async stuff using Celery. In this post, I will do the magic tricks first, explain them later. Add Celery to Django To add celery, we need make a container for celery. We can re-use the Dockerfile of django for making celery’s container like this:

02 Nov 2016, 17:24

Serve Static Files by Nginx from Django using Docker
This is more of a follow up post of my previous blog. Before I start, I am assuming you have successfully deployed django using docker & nginx, but having some problems serving static files. Steps No worries, its easy. Just follow these steps: 1. In your django file, add static file directory i.