Creating a Django Project

What is Django ?

Django is a Python -based free and open-source web framework, which follows the model-template-view architectural pattern. It is maintained by the Django Software Foundation, an independent organization established as a 501 non-profit. Django's primary goal is to ease the creation of complex, database-driven websites
To be able to use Django, you need to install the following software:
  • Python 3, to enjoy the third version innovations.
  • setuptools is a module that simplifies the installation of the external Python module. However, it does not manage to uninstall the module.
  • PIP extends the possibilities of setuptools by removing packages,using easier syntax, and providing other benefits.
  • Django, which that we are going to install thanks to PIP.

Installing Python 3 

To use all the tools that we have talked about so far, we first need to install
Python 3. The following sections describe how we can install Python on
Windows operating systems.


Installing Python 3 for Windows 

Django is a Python web framework, thus requiring Python to be installed on your machine. At the time of writing, Python 3.5 is the latest version.
To install Python on your machine go to https://python.org/downloads/. The website should offer you a download button for the latest Python version. Download the executable installer and run it. Check the box next to Add Python 3.7.4 to PATH and then click Install Now.

If you installed this version then you dont need to install pip separately  
If dont know how to set the PATH on windows operating System then you will simply select the checkbox  Add Python 3.7 to PATH  & Click on Install Now Option shown in the below image .
 



After installation of python 3.7.4 , open the command prompt and check that the Python version matches the version you installed or not

           python --Version
After that completion installation of Python 3.7.4  then you can check pip version 

pip --version 


After that 
Virtual Environment

Install virtualenv and virtualenvmrapper 

virtualenv and virtualenvwrapper provide a dedicated environment for each Django project you create. While not mandatory, this is considered a best practice and will save you time in the future when you’re ready to deploy your project. Simply Enter 

pip install virtualenvwrapper-win

Before installing Virtual Environment you must be open Windows PowerShell  Run as an Administrator  for installing virtualenvwrapper-win
after that simply copied above command & paste on it .

Then create a virtual environment project using ...
mkvirtualenv myproject


The virtual environment will be activated automatically and you’ll see “(myproject)” next to the command prompt to designate that. If you start a new command prompt, you’ll need to activate the environment again using:
workon myproject


Install Django


Django can be installed easily using pip within your make virtual environment.

In the command prompt, ensure your virtual environment is active, and execute the following command:

pip install django

if django is successfully installed then you check then django version 

python -m django --version 

Before we create first djnago project make sure that we have a specific folder for my django project so in the  followining image already shown that how to make folder for our first django project lets see ...
Now we want to create our first django project here so using ...

django-admin strtproject mysite 

After creating the project "mysite" so we need to run our server 
using python manage.py runserver is as followes
Now the server is running successfully after that running the django server we must be simple copy the Url http://127.0.0.1:8000/ and paste on the browser 
 
so this is our first django project .
Thank you !

Comments