How To Setup Django Project
Overview
Today we will learn how to setup Django project on machine. At the end of this article you will get successful running Django app.
Prerequisites:
You should have some Python experience and know basic Unix bash commands. If you’ve never used the command line before, please familiarize yourself with the following commands: pwd, cd, rm, and mkdir etc.
Steps to create django project:
-
Install python (Click Here to get pyhton download link)
-
Install virtual wrapper using pip command
pip install virtualenvwrapper-win
Output of above command is as follows: -
Create virtual environment to separate current project from other project libraries. It’s common practice to use a virtualenv (virtual environment) for your Python projects in order to create self-contained development environments (also called “sandboxes”). The goal of virtualenv is to prevent different versions of libraries/packages from messing with each other.
mkvirtualenv test
Output of above command is as follows: -
Now we will install django in above created virtual environment.
pip install django
Output of above command is as follows: -
We will create new project with name “project_name” using below command
django-admin startproject project_name
This command creates new project and its structure. Please refer below screenshotPlease find below screenshot of created project structure
-
Now we will run our currently created project
a. Go to project folder
cd project_name
b. Run following python command
python manage.py runserver
You will get following output on command prompt. -
Now go to web browser and open link 127.0.0.1:8000. you will get following output.
This is the way you can setup django project. Please like and share this article if you like it.
Comments
Post a Comment