How To Setup Django Project

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:

  1. Install python (Click Here to get pyhton download link)

  2. Install virtual wrapper using pip command
    pip install virtualenvwrapper-win
    Output of above command is as follows:

  3. 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:

  4. Now we will install django in above created virtual environment.
    pip install django
    Output of above command is as follows:

  5. 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 screenshot

    Please find below screenshot of created project structure

  6. 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.

  7. 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

Popular posts from this blog

Sonarqube Integration with Visual Studio 2022 and VS Code

Run And Debug Test Cases Using Jest With Different CLI Options

Install Kibana as Windows Service Using Powershell