This article will show how to install Django Framework. The installation process of the Django Framework is done in a Windows operating system. There are several requirements that need to exist before the actual installation process can start. Those requirements are in the following list :
1. It need a prior python installation in the Windows operating system.
2. It also need as an additional option to have a virtual environment where it is in the active state.
3. After success on having the first and the second requirement to be exist, just execute the following command :
pip install django
Below is an example of the above command execution for installing Django Framework :
(myenv) C:\python-win\app>pip install django Collecting django Downloading Django-3.0.5-py3-none-any.whl (7.5 MB) |████████████████████████████████| 7.5 MB 33 kB/s Collecting sqlparse>=0.2.2 Downloading sqlparse-0.3.1-py2.py3-none-any.whl (40 kB) |████████████████████████████████| 40 kB 215 kB/s Collecting pytz Downloading pytz-2019.3-py2.py3-none-any.whl (509 kB) |████████████████████████████████| 509 kB 656 kB/s Collecting asgiref~=3.2 Downloading asgiref-3.2.7-py2.py3-none-any.whl (19 kB) Installing collected packages: sqlparse, pytz, asgiref, django Successfully installed asgiref-3.2.7 django-3.0.5 pytz-2019.3 sqlparse-0.3.1 (myenv) C:\python-win\app>
The above output shows that the installation of the Django Framework is actually a success. Actually, there are two ways for proving that the module of Django Framework exist with the success of the previous installation. Checking whether the installation is a success or not is quite easy. The first way is by executing the following command :
pip freeze
Below is the execution of the above command with the output given :
(myenv) C:\python-win>pip freeze asgiref==3.2.7 Django==3.0.5 pytz==2019.3 sqlparse==0.3.1 (myenv) C:\python-win>
The second one is by execute or run the actual application using Django Framework. The following is the command for running that kind of application :
python manage.py runserver
The following is the example of the above command execution for running the application using Django Framework :
(privenv) C:\python-win\app>python manage.py runserver Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run 'python manage.py migrate' to apply them. April 15, 2020 - 20:05:00 Django version 3.0.5, using settings 'app.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK. [15/Apr/2020 20:05:13] "GET / HTTP/1.1" 200 16351 [15/Apr/2020 20:05:14] "GET /static/admin/css/fonts.css HTTP/1.1" 200 423 [15/Apr/2020 20:05:14] "GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1" 200 85876 [15/Apr/2020 20:05:14] "GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1" 200 85692 [15/Apr/2020 20:05:14] "GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1" 200 86184
According to the above output, the server is running successfully. Moreover, in order to make sure that the application is available for further access, just try to visit it via web browser by typing the URL of ‘http://127.0.0.1:8000’ or localhost:8000 in the address bar as in the following image :