StackPointers

Be Coded….

Python

Django – A high-level Python Web framework

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.

So we will learn part by part here about Django from scratch i.e. installation to building your first Django App.

Tutorial Part 1 :

We will be install Django in virtual environment because i will be using specific version of Django, Let’s do this.

mkdir dev
cd dev

Inside dev Folder i will be creating trydjango directory

mkdir trydjango
virtualenv -p python3 .
source bin/activate
pip install Django==2.0.7

After successful installation of Django in our virtual environment, let’s try our first command to test whether we have installed Django successfully.

django-admin

Above command will give you available subcommands with respect to django-admin.

Check
compilemessages
dbshell
……
startapp
startproject

Lets create our first project using below command:
django-admin startproject trydjango .
Let’s check the files created after running above command

So one python file and one directory which contains files related to Django is created. Next, will check whether we are able to run the server.
python manage.py runserver

After running above command you will notice that server will be running on the ip – http://127.0.0.1:8000/ where Django uses :8000 has a default port.

Above image indicates that you have successfully ran Django server in our system.

Comments are Closed

Theme by Anders Norén