Virtual Environment in Python – A Pocket Guide

In almost every article, we recommended the use of virtual environment for developing any Python or Django project.

In this article, we will briefly cover the virtual environment in python, installation and usage.

What is a Virtual Environment:

Virtual environment is an isolated python environment which can be created using virtualenv python tool. This virtual environment contains all the packages that a python package would require. Python project running in virtual environment does not use the system wide installed python package.

Continue reading “Virtual Environment in Python – A Pocket Guide”

Elastic Search with Kibana and Django

In this article we will see how to implement fast text search using elastic search instead of using MySQL or PostgreSQL.

System configurations:

– Ubuntu 16.04
– Python 3.5, Django 1.10
– Elastic Search v6.0.0
– Kibana v6.0.0

Elastic Search:

As per Wikipedia:

Elasticsearch is a search engine based on Lucene. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.

ElasticSearch indexes documents for your data instead of using data tables like a regular relational database does.

There are two client libraries to interact with ElasticSearch with Python.
1. elasticsearch-py
2. elasticsearch-dsl

Continue reading “Elastic Search with Kibana and Django”

How to create completely automated telegram channel with python

In this article we will see how to create a completely automated telegram channel. To demonstrate the process we will take through the example of a telegram channel News India ( created by me which post news every hour.

The automated process of generating content and posting on the channel is divided into three parts. Creating telegram channel and bot, generating/fetching content using python script and posting the content to telegram channel.

Creating telegram channel and Bot:

-Install telegram app from Google Play.
-After you are done with initial setup. Click on menu and create a new channel.

Continue reading “How to create completely automated telegram channel with python”

Difference between list and tuples in Python and more such comparisons

In this article we will see key differences between commonly used terms in python. For example difference between tuple and list, difference between range and xrange and so on.

List and Tuples:

– are mutable i.e. we can add, extend or update a list.
– generally are homogeneous data structures.

– are immutable i.e. we can not update a tuple.
– generally are heterogeneous data structure.
– is a sequence where position have semantic value.
– are more like records, collection of fixed number of fields.

Continue reading “Difference between list and tuples in Python and more such comparisons”

Python Script 3: Validate and format JSON string

As per official JSON website, JSON is a light-weight data interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition – December 1999.

In this small article we will see how to validate and format the JSON string using python.

Format JSON string:
Continue reading “Python Script 3: Validate and format JSON string”

How to upgrade to paid account on PythonAnyWhere

When I started developing Django applications, one constant concern I had was ‘which is best server for hosting Django applications?’.  I read multiple articles about hosting the Django app, hosting service providers and server providing Django support. Most of them provides support for python but very few provide support for django.

I even purchased hosting space on two servers but thanks to money back guarantee scheme, my money was returned as I was not satisfied with their service. Finally I settled for PythonAnyWhere. I liked PythonAnyWhere for its simplicity.

Continue reading “How to upgrade to paid account on PythonAnyWhere”

How to share data between two systems using python simple HTTP server

Consider this, you want to share files between two system or you want to send really large file to your friend or you want to share new season of ‘The big bang theory’ among your peers. What if you do not have pen drive with you. What if file size is larger than pen drive capacity? What if you have some file which is required by 100 people.

Python Simple HTTP server comes to the rescue. Using a one line command in your terminal you can overcome all limitations discussed above.

Continue reading “How to share data between two systems using python simple HTTP server”

List of Indian States in Python Format

So I was working on a project where I needed list of Indian States in Python format. I looked around on the web but the data was not available in required format. So I decided to create the list of Indian states in different formats which can be used directly in Python-Django project.

You can simply copy paste the data in any of the below format.

Continue reading “List of Indian States in Python Format”

How to send bulk emails for free using Mailgun and Python Django

Consider these scenario in your newly developed Django Application:

  • You need to send promotional emails to all the registered users.
  • You need to send email confirmation link or password reset link.
  • You need to send weekly newsletter to you readers.

What do you choose? Free Gmail Account to send email using python code? That is a nice idea provided you want to look unprofessional and you need not to send more than 500 emails per day.

But if you want professional look in your emails [from address something like  instead of  and do not want the limit on per day email count, then this article is for you.

Continue reading “How to send bulk emails for free using Mailgun and Python Django”

What is the meaning of different aphorism in zen of python

The Zen of Python is a collection of 20 software principles that influences the design of Python Programming Language.

Continue reading “What is the meaning of different aphorism in zen of python”