Home » Django

Django | How to create first Web Application?

Django | First Web Application: Here, we are going to learn how to create first web application in Django? Also learn how to install, setup the environment?
Submitted by Pankaj Singh, on October 12, 2018

Pre-Requirements:

  1. Python 3.x/2.x
  2. PyCharm [Professional Edition]2017/2018
  3. Django 1.9/2.x
  4. Virtualenv [Virtual Environment]

Python Installation

Step 1: Open browser https://www.python.org/downloads/in and download Python Installer [Python 3.4.4]

Step 2: Double-Click on Installer and follow the steps.

Step 3: Check whether python is installed on your system or not. For this open "cmd" and type python –version

Django Installation 1

PyCharm Installation

Step 1: Open https://www.jetbrains.com/pycharm/download/#section=windows in browser and download Pycharm Professional Edition.

Note: Django Project template is not available in Pycharm Community Edition

Step 2: Double-Click on Installer and follow the steps.

Django Installation

Step 1: For this open Command Prompt (cmd) and type pip install Django==1.9

Django Installation 2

Virtualenv [Virtual Environment] Installation

Step 1: For this open Command Prompt (cmd)and type pip install virtualenv

Django Installation 3

There are two different approach to create Django Sample App

1. Using CLI

Step 1: Open Command Prompt (cmd)

Step 2: Navigate to your Workspace (Location where we want to put our sample app) [C:\Users\phloe\Desktop\IncludeHelp\Articles\Django\Sample App Creation]

Django Installation 4

Step 3: Create a Sandbox [Virtual Environment]

Django Installation 5

Step 4: Activate the sandbox

Django Installation 6

Step 5: Install Django inside Sandbox

Django Installation 7

Step 6: Create a Django Project

Django Installation 8

Step 6: Navigate inside Sample App. This App contains

  1. Admin Module (It have same name as project name i.e. sample)
  2. Manage.py
Django Installation 9

Step 7: Run the sample app.

Django Installation 10

Step 8: Open browser and navigate to http://127.0.0.1:4500

Django Installation 11

2. Using IDE

Step 1: Open PyCharm Professional Edition

Django Installation 12

Step 2: Create New Project

Django Installation 13

Django Installation 14

Django Installation 15

Step 3: Select your project in Project Explorer.

Django Installation 16

Step 4: Open Manage Task Console from Tools Menu

Django Installation 17

Django Installation 18

Step 5: Type following command to run app runserver 4600

Django Installation 19

Step 6: Open browser and navigate to http://127.0.0.1:4600

Django Installation 20


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.