Most of articles on internet are not explaining thoroughly how to set-up a Django application. In this article, not only we are going to set-up a project and an application, but also set-up static files, html templates and our first view.

Before getting started, you should set-up a virtual environment for your Django activities. Check this article until your virtual environment is up.

Initiate project and app

To initiate a django project, start with this command line :

django-admin startproject <name_project>
django start project
django start project

This directory is the root of your project. Within it, you have another directory with the same name which is the project directory.

Once you reach a good level in python, you’re writing your own functions or classes in order to get things done.

For instance, my work as a data scientist would be less comfortable without those two functions :

def myTrivialFunction_1():
print("I'm the most important function - ever")
def myTrivialFunction_2():
print("I'm also very important")

myTrivialFunctions are good-looking and short. One can easily copy and paste it on a notebook cell and run it so they are available. So it doesn’t hurt the eyes in your notebook or your script.

But sometimes, you write things that… well… it works, but it’s not…

In this article, I’ll explain how to set up a virtual environment in python. It is useful either if you’re a web developper using Django or a data scientist using notebooks. If you’re a beginner in python or if you’re done with anaconda, you’re about to read the right article !

Most of data scientists around me are taking lightly the set up of a virtual environment for their data science activities. Yet, knowing how to set it up correctly can free you from technical constraint imposed by the solution handling the virtual environment for you, such as Anaconda.


Will Barillon

A data scientist that wants to provide useful informations to everyone on the data science field.

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