Installation Of Django
Install python if not installed in your system ( according to configuration of your system and OS)Try to download the latest version of python it’s python 3.11.0 this time.
Django can be installed easily using pip . In the command prompt, execute the following command: pip install django . This will download and install Django. After the installation has completed, you can verify your Django installation by executing django-admin –version in the command prompt.
Click here to download latest version
What is django?
Django is a high-level Python web framework that enables rapid development of secure and maintainable websites.
Built by experienced developers, Django takes care of much of the hassle of web development, so you can focus on writing your app without needing to reinvent the wheel. It is free and open source, has a thriving and active community, great documentation, and many options for free and paid-for support.
Click here to learn more about django
Where is Django installed?
Django is generally going to be installed in the site-packages directory of the Python directory you’re using. If you’re on an unfamiliar machine however where that is may not be immediately obvious so here’s a way to be sure.
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.
- pip command
The pip command looks for the package in PyPI, resolves its dependencies, and installs everything in your current Python environment to ensure that requests will work. The pip install <package> command always looks for the latest version of the package and installs it.
- 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 vertual 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
- 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
activate
- 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 geeks_site
- Change directory to geeks_site
cd geeks_site
- 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.
Popularity of Django
Django is a fast, secure, and flexible Python framework that works hand-in-hand with data science and data analytics. According to GitHub, Django is the 2nd most starred Server Side framework after Laravel. The thing that makes Django a popular framework is its ability to strike the right balance between enterprise features and rapid application development. Moreover, the clean design of Django drags all developers. That is why Django framework development has a huge demand from business enterprises of all sizes and types.
JR Rickerson, A Python Expert, and Instructor at DevelopIntelligence, says, “For web development, my go-to framework is Django. Django is one of the oldest web frameworks in the Python community, and it can be considered by some to be bloated, but everything I need to get a new client up and running with a web application is built-in or easily available via the huge ecosystem of Django apps. I don’t need to spend any billable time on boilerplate.”
This statement tells too much about why the Django framework is a favorite tool. Python is the natively supported programming language for Django.
Django is used in many popular sites like as: Disqus, Instagram, Knight Foundation, MacArthur Foundation, Mozilla, National Geographic etc. There are more than 5k online sites based on the Django framework. ( Source )
Sites like Hot Frameworks assess the popularity of a framework by counting the number of GitHub projects and StackOverflow questions for each platform, here Django is in 6th position. Web frameworks often refer to themselves as “opinionated” or “un-opinionated” based on opinions about the right way to handle any particular task. Django is somewhat opinionated, hence delivers the in both worlds( opinionated & un-opinionated ).