Finally Into Django!!

Ashish Sharma
4 min readMar 13, 2018

I have been talking about starting Django from the past few weeks. As I was caught up in other stuff, I was sharing some designs using Turtle in Python. But now, finally I stepped into Django with the help of Udemy. Udemy.com is an online learning platform which uses the content from online content creators for their profit (I got this from google). I learnt a bit of Flask, but my brother was suggesting me from a long time to get into Django due its vast usage. Disqus, Bitbucket, Instagram, Mozilla Firefox are some of the sites built using Django framework. Django has a well written documentation which can be found on: https://docs.djangoproject.com/en/2.0/#index-first-steps. I did a “BIG PROJECT” using Flask few months back , if I get my hands on Django properly, maybe I can do a bigger project in Django!!!

In Django we will be dealing with virtual environment which allows a virtual installation of python and packages. We need virtual environments because python packages get updated often and these changes may have an affect on our website. Hence in order to test new features, we create a virtual environment. For example, suppose we have build our website with a package named X.02. Later this package gets an update and now we have X.03 available with us. In order to check the compatibility of our site with this newer version, we can create a virtual environment, install the package and see the result. Unfortunately, if the results are negative, there is no need to worry as our original site is still intact!! That’s the advantage of creating a virtual environment which can be created by using Anaconda.

Anaconda has a virtual environment handler which can be used to create a virtual environment. We can download the Anaconda from https://www.anaconda.com/download/, but you can see below that the size of anaconda is too big,

Hence instead of Anaconda, we can download a smaller version of Anaconda named Miniconda from: https://conda.io/miniconda.html. I downloaded the miniconda for 64 bit windows having a size of around 55 Mb. After installing the miniconda, we can open our Anaconda Prompt:

Now to create a virtual environment we have to use the following command:

conda create — — name ProjectName

As soon as we press enter, we can see whether any updates are available for our conda and then it will ask our permission proceed. As you can see, I proceeded without updating but you can update conda using: conda update conda.

On the leftmost side, base is written inside the parenthesis which indicate that currently we are not in any virtual environment. As soon as we activate our environment, we can see the name of our environment in parenthesis. If we deactivate, we will get back to our base:

We can view all the available environments by using the following command:

conda info — — envs

We can remove an environment by using following command:

conda env remove — — name EnvName

We can install the latest version of django by: conda install django. So that’s all for today, I will going slowly into Django as I am studying it in parallel. Feel free to go through Django documentation and clear your doubt. We will create our server in the next blog, till then keep coding…

Thank you for reading, if you liked the article please click on the clap button and show your support. You can clap more than once, just keep pressing the icon!!!

--

--