...

Open source softwares - Django

Back to Course

Lesson Description


Lession - #970 Django-Get Started


Django Requires Python

To check assuming your system has Python install, run this command in the command prompt:
python --version
On the off chance that Python is install, you will come by an result with the version number, similar to this
Python 3.9.2

On the off chance that you find that you don't have Python install on your PC, then you can download it free of charge from the accompanying site: https://www.python.org/

PIP

To install Django, you should utilize a package manager like PIP, which is remembered for Python from version 3.4.

To check assuming that your framework has PIP install, run this command in the command prompt:

pip --version
In the event that PIP is install, you will come by an result with the version number.

For my purposes, on a windows machine, the result seems to be this:
pip 20.2.3 from c:\python39\lib\site-packages\pip (python 3.9>
In the event that you don't have PIP install, you can download and install it from this page:https://pypi.org/project/pip/

Virtual Environment

It is proposed to have a dedicated virtual environment for each Django project, and one method for dealing with a virtual environment is venv, which is remembered for Python.

With venv, you can establish a virtual environment by composing this in the command prompt, make sure to explore to where you need to make your project:

Windows
py -m venv myproject
Unix/MacOS
python -m venv myproject
This will set up a virtual environment, and make an folder named "myproject" with subfolders and documents, similar to this:
myproject
  Include
  Lib
  Scripts
  pyvenv.cfg

Then, at that point, you need to activate the environment, by typing this command

Windows
myproject\Scripts\activate.bat
Unix/MacOS
source myproject/bin/activate

When the environment is activated, you will see this result in the command prompt:

Windows
(myproject>
C:\Users\Your Name>
Unix/MacOS
(myproject>
... $

Install Django

At long last, we can install Django.

Make sure to install Django while you are in the virtual environment

Django is install utilizing pip, with this command:

Windows
(myproject>
C:\Users\Your Name>py -m pip install Django
Unix/MacOS
(myproject>
... $ python -m pip install Django

Windows,Mac or Unix?

You can run this project on either one. There are a few little differences, similar to while composing commands in the command prompt, Windows utilizes py as the main word in the command line, while Unix and MacOS use python:

Windows
py --version
Unix/MacOS
python --version