How to Install Django on Ubuntu 22.04 – Its Linux FOSS | 您所在的位置:网站首页 › Django22安装 › How to Install Django on Ubuntu 22.04 – Its Linux FOSS |
Django is a very famous framework of python; it is an open-source backend framework of Python. Django framework is used for full-stack web apps and server development. It is a fully-featured framework and it does not need external libraries, because it is a full-stack framework. Django helps in the fast development of the most secure websites. The Django framework is used to develop complicated and data-driven websites. Django framework is also involved in the development of social media platforms. Django. Django allows the development of fast, secure, and maintainable websites. Django was developed by python developers in 2003, and Django is written in Python and HTML. This article elaborates on all the procedures involved in the installation of Django on Ubuntu 22.04. How to install Django using the official repositoryOfficial repository is a storage location from where the user can install the official package software for Linux distros. Let’s dig into detail to find the procedure of installation using the official repository method. Step 1: Update the system packagesOpen the Terminal by pressing the shortcut key “CTRL+Alt+T”, and write the following command to update the system packages. $ sudo apt updateNext step is to check Python installation. Python comes pre-installed in Ubuntu so to Check the latest version of python installed on the system, run the below command in the terminal. $ python3 --versionThe Python version confirms that it is already installed on the system so we don’t need to install python. However, if Python is not installed on your system due to some reason, install it by following our dedicated article: install python on Ubuntu Step 3: Install DjangoInstall Django using the following command, we are using -y in the following command, which means it will not ask for your confirmation again which is [Y/N] $ sudo apt install python3-django -yNow, Django is installed, verify its installation by checking its version. $ python3 -m -django --versionThe Python version number confirms that Django is successfully installed on the system. How to install Django using pipPIP is an installation manager of python packages. PIP is a short form of Pip installed in Python and it is a cross-platform supported package manager. Pip helps Python packages to install on the system. Step 1: Update the system packagesOpen the Terminal by pressing the shortcut “CTRL+Alt+T”, and update the system packages by using the update command. $ sudo apt updateTo install Django, you must have Python installed on your system because it is a framework of Python. Python comes pre-installed in ubuntu so to Check the latest version of python installed on the system, run the following command in terminal $ python3 --versionThe Pythons version number is evidence that Python is already installed on the system. Step 3: Install pip and venvInstall venv(used to create virtual environments for different projects) and pip using the ubuntu repository, we used -y in the following command, which means it will not ask for permissions again and again. $ sudo apt install python3-pip python3-venv -yCreate a new directory using the “mkdir” command where we can reside our project and move in to the newly created project directory using the “cd” command as shown in the following commands: $ mkdir ~/newproject $ cd ~/newprojectCreate a new virtual environment (my_env) by executing the venv module: $ python3 -m venv my_envNew environment created successfully. Step 6: Activate the new environmentActivate the virtual environment that you have created by using the command below. $ source my_env/bin/activateThe Environment is created and activated, just install Django using pip: $ pip install djangoDjango framework is installed successfully and executes the below command to check its version. $ django-admin --versionThe version number verifies that Django is installed on the system. How to deactivate the environmentTo deactivate the environment simply run the deactivate command in the terminal. $ deactivateThe (my_env) is removed which confirms that the environment is deactivated successfully. How to remove Django from Ubuntu 22.04In the Django installation section, we have performed two methods. Similarly, we are going to use those two methods which are the official repository and pip to remove Django from Ubuntu. Let’s find out how we can remove Django. How to remove Django from Ubuntu using the official repositoryThe removal process is almost the same as the installation process. To do so, execute the following command to remove Django from Ubuntu using the official repository. $ sudo apt autoremove python3-django -yThe output shows that the Django and its configuration files are removed from Ubuntu 22.04. How to remove Django from Ubuntu using pipYou need to have access to the directory in which it is installed and the environment must be activated to remove the Django from Ubuntu using pip. Execute the following command. $ pip uninstall django -yThe Django will be removed. Here you go! You have learned to install as well as remove Django on Ubuntu 22.04 via its repository and pip. ConclusionDjango can be installed on Ubuntu 22.04 via the official repository and the pip methods. To install Django you must have Python installed on your system because Django is a framework of Python. Django is a web-based python framework used to develop web-based applications. This article demonstrates various methods to install Django on Ubuntu 22.04. TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY [email protected] |
CopyRight 2018-2019 实验室设备网 版权所有 |