Django

Deploy Django, Gunicorn, NGINX, Postgresql using Docker

This post mainly based on this blog: https://docs.docker.com/compose/django/. I will be extending this post by serving django+gunicorn using Nginx, also I will using Postgresql docker container to use it as database. Lets not waste time and go to the following steps. 1. Let's make an empty directory named myproject and add another folder inside name it src. src should contain the django project. For testing purpose lets put a simple django project inside named mydjango. 2. Let's create a subdirectory inside myproject and name…

Keep reading

Make a Blog using Django Part 2

From previous post, you have configured and ran django, also added admin site to the django. To view the working source of this tutorial, check here at: https://github.com/ruddra/myblog Now click on the myblog section and click add to add new blog. You can create new tags using Tags section of the admin page or clicking the (+) button right beside the Tags section on the new blog creation page, marked with blue circle in the previous image. After successfully adding a new blog, you can see it…

Keep reading

Make a Blog using Django Part 1

"Making a blog using django" is probably the most made tutorial of Django. This post is no different. But I made this in my own way using some of django's built-in features so that less coding is required and making it more understandable with minimum packages to use. To view the working source of this tutorial, check here at: https://github.com/ruddra/myblog Before jumping to the main event, see if you have these installed in your pc: 1. Python 3 installed in the computer. (Or python 2.7…

Keep reading

Change Column Header Dynamically in Django Tables2

Django Tables2 is a package which displays table directly from queryset. It shows column header based on object's attribute's name. But if someone wants to override it, how can he/she do that? Here is a easy solution. Suppose we have a model class like this: class SomeModel(models.Model): somevalue = models.CharField() And we want to show table column somevalue to overridenvalue Table Class: class SomeTable(tables.Table): def __init__(self, *args, _overriden_value="",**kwargs): super().__init__(*args, **kwargs) self.base_columns['somevalue'].verbose_name = _overriden_value class Meta:…

Keep reading

How to configure Django/Tornado in PyCharm Community Edition

I think, Pycharm is THE best IDE for developing python. But unfortunately, the professional edition is not free. But community edition is good enough for doing debugging, integrating GIT etc. Normally its easy to use the community edition for django and tornado's debugging/running if you know how to configure. Django For django's configuration, there is 5 easy steps: First: Go to edit configuration and click on it(like the below pictures). Second: Click on the (+) mark in top-left corner and add python configuration. Third: Click on the Script, and…

Keep reading