top of page

Django Introduction and Installation

What is Django?

Django is a Python-based web framework which allows you to quickly create web application without all of the installation or dependency problems that you normally will find with other frameworks. When you’re building a website, you always need a similar set of components: a way to handle user authentication (signing up, signing in, signing out), a management panel for your website, forms, a way to upload files, etc. Django gives you ready-made components to use.

Why Django?

  1. It’s very easy to switch database in Django framework.

  2. It has built-in admin interface which makes easy to work with it.

  3. Django is fully functional framework that requires nothing else.

  4. It has thousands of additional packages available.

  5. It is very scalable.

Installation of Django

  • Install python3 if not installed in your system ( according to configuration of your system and OS) from here . Try to download the latest version of python it’s python 3.11.0 this time.

Note- Installation of Django in Linux and Mac is similar, here I am showing it in windows for Linux and mac just open terminal in place of command prompt and go through the following commands.

  • Install pip- Open command prompt and enter following command-

python -m pip install -U pip
  • Install virtual environment- Enter following command in cmd-

pip install virtualenv
  • Set Virtual environment- Setting up the virtual environment will allow you to edit the dependency which generally your system wouldn’t allow. Follow these steps to set up a virtual environment-

  1. Create a virtual environment by giving this command in

cmd-virtualenv env_site
  • Change directory to env_site by this command-

cd env_site

Go to Scripts directory inside env_site and activate virtual environment-

cd Scripts
  • Install Django- Install django by giving following command-

pip install django
  • Return to the env_site directory-

cd ..
  • Start a project by following command-

django-admin startproject p4n-app
  • Change directory to p4n-app

cd p4n-app
  • Start the server- Start the server by typing following command in cmd-

python manage.py runserver
  • To check whether server is running or not go to web browser and enter

 http://127.0.0.1:8000/ as url.


Related Posts

See All

Comments


bottom of page