In a quest of being adept at working with data, understanding a languange / frameworks that works well in numbers manipulation is essential.
Before we get started, you’ll need to have;
Installation of the above prerequisites,
python comes preinstalled in most os’s but you could always confirm your version using:
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
if you see something like this, then python is installed. Exit this shell using :
ctrl + D
It is recommended that you use virtualenv to create isolated Python environments,
so you can use different package versions for different projects
install by Running the following command in your shell:
$ pip install virtualenv
after installing virtualenv,
setting up the environment
once through with the installations,
create a directory where your project will reside in move into it with :
$ mkdir myproject
$ cd myproject
create an isolated environment with :
$ virtualenv my_env
activate the virtual environment by running :
$ source my_env/bin/activate
the shell will now include the name of the active virtual environment enclosed in parenthesis like:
you can always deactivate environments with deactivate command.
using pip installed , get on installing Django with the following command,
(my_env):myproject $ pip install Django
to check that has been installed successfully, run:
(my_env):myproject $ python
>>> import django
(1, 10, 5, ‘final’, 0)
with an active environment, you can now embark on that project you are building.
start of project
(my_env):myproject $ django-admin startproject mystic_falls
this creates a django project by the name ‘mystic_falls’* which has a basic structure
.(use whatever name you prefer for your project).
run the command below to work from project root folder and initialize application database :
(my_env)4bic:myproject $ cd mystic_falls
(my_env):mystic_falls $ python manage.py migrate
The development server is ready to fire up, run:
(my_env):mystic_falls $ python manage.py runserver
on your browser, open http://127.0.0.1:8000/ , you should see:
.. “Welcome to Django” page.
You are now ready to create you own app.
Next Step : Creating an application
In Django, Applications provide some specific functionalities, think of the project as your website, which contains several applications like blog, wiki, or forum, which can be used in other projects.
We’ll create an app in subsequent blog