Quick Bits

Simple and Quick guide to install RabbitMQ on Ubuntu

$ sudo apt-get install -y rabbitmq-server
$ sudo systemctl start rabbitmq-server
$ sudo systemctl status rabbitmq-server
$ sudo systemctl enable rabbitmq-server

You can learn more about RabbitMQ Virtual Host here.

$ sudo rabbitmqctl add_user myuser mypassword
$ sudo rabbitmqctl add_vhost myvhost
$ sudo rabbitmqctl set_user_tags myuser mytag
$ sudo rabbitmqctl set_permissions -p myvhost myuser ".*" ".*" ".*"

The broke url would be
BROKER_URL = amqp://myuser:mypassword@localhost/myvhost


Django & Docker

The solution to why Django Debug Toolbar does not show up when using Docker.

Django Debug Toolbar is an essential tool in the development process of a Django application.

This article provides the solution as well as an explanation. If you just want the solution please scroll down to Solution 2 and 3.

Django Debug Toolbar has a setting called INTERNAL_IPS . The Toolbar only appears if the IP addresses from which the user is accessing the application is listed in INTERNAL_IPS . This is a security feature of the Django Debug Toolbar so that the Toolbar cannot be accessed by users accessing the application from different IP addresses. The developer can set his/her…


Just using a version control system like Git, isn’t enough, if you are not using its best feature, Branches.

If you aren’t using a version control system in your project then STOP whatever you are doing right now, and START using one.

But first, the question is!!

When do we have to use branches in git?

Answer 🥁🥁drum roll please🥁🥁.. ALWAYS!!
No matter the team size 0,1,2,3,4,5,6,7…100………..9999999999, No matter whatever excuses you have, you have to use branches.

The type Git workflow detailed here is called GitFlow Workflow. GitFlow Workflow was published and made popular by Mr. Vincent Driessen at nvie.

We’ll start with the different types of branches that we need to have

  1. Master/Main
  2. Development
  3. Feature
  4. Release
  5. Bugfix


An image containing Python programming language logo on the left side and a Microsoft Excel logo on the right side

Openpyxl has a “max_row” function the get the maximum rows of an excel sheet as shown below

import openpyxl
workbook = openpyxl.load_workbook(<filepath>)

# <filepath> is the path of the excel file
sheet_object = workbook.active
max_rows = sheet_object.max_row

However when using it to get the maximum rows in the sheet, sometimes it even counts the empty rows, this is because the max row function returns the maximum row index of the sheet, not the count of rows containing the data.

Example: Let’s say an excel/google sheet file is created with 10 rows data and 5 rows of data are removed, the…


If you’d ask me, Is Django Debug Toolbar a good tool to have during development?, I’d say, you’re wasting your time thinking that, just close your eyes and ‘pip install django-debug-toolbar’.
I’m not even gonna try to give you the advantages of it, because once you start using it, you’ll know.

The moment you click the DebugToolbarHandle icon, your mind will be blown

So Let me help you to Install and Configure it.

$ pip install django-debug-toolbar

In your settings.py add

if DEBUG:
INSTALLED_APPS += ['debug_toolbar',]
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware',]
INTERNAL_IPS = [
'127.0.0.1',
]

If the Django Development server is…


Homebrew makes it very easy to Install lot of packages on Mac.

First install Homebrew on your Mac from here.

$ brew install redis
$ brew services start redis

Redis server will be started on default port 6379

$ redis-cli pingPONG

You should receive a response PONG if the redis server is running.

$ brew services stop redis
$ brew services restart redis
$ brew info redis

If you don’t want to have the Redis server running as a background service, then.

$ redis-server /usr/local/etc/redis.conf

Stop Redis Server with cmd + c

Here you go!!


Django Channels is a project that takes Django and extends its abilities beyond HTTP, to handle WebSockets, chat protocols, IoT protocols, and more. It’s built on a Python specification called ASGI. Django Channels has been updated to version 2 and has a lot of improvements from the previous version.

This Article shows how to send realtime notifications to logged in users with Django Channels 2.

A Django Project already up and Running :P

  1. Use the python package manager pip to install django-channels.
(myvenv) $ pip install django-channels

Add ‘channels’ to the installed apps in the settings

2. Install channels-redis

(myvenv)…


As developers, showcasing our work to the clients require us to host our application on the cloud. Heroku offers a free, yeah a free plan to host our applications.

This tutorial is for devs who want to use Heroku as a development server.

Prerequisites
A Django Project

Step 1 : Installing Dependencies

(myvenv) $ pip install dj-database-url gunicorn whitenoise psycopg2(myvenv) $ pip freeze > requirements.txt

Step 2 : Creating Procfile

Create a file with the filename Procfile in the project root directory, i.e in the directory where the manage.py file exists. The file doesn’t have any extension.

Add the…

Ranjan MP

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store