{"id":27860,"date":"2021-06-09T12:30:00","date_gmt":"2021-06-09T17:30:00","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=27860"},"modified":"2022-06-03T03:31:39","modified_gmt":"2022-06-03T08:31:39","slug":"how-to-install-django-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/","title":{"rendered":"How to Install Django on CentOS 7"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div>\r\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"742\" height=\"372\" class=\"wp-image-37148\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7.jpg\" alt=\"how to install django on centos 7\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7.jpg 742w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7-300x150.jpg 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7-150x75.jpg 150w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>In this tutorial, we will show you how to install Django on CentOS 7. Django is a free and open-source, Python-based web application framework. It is a set of useful components that help developers to easily and quickly create their applications.<\/p>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"alignright is-resized\"><img decoding=\"async\" class=\"wp-image-36412\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-framework-on-centos-7.jpg\" alt=\"how to install django framework on centos 7\" width=\"340\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-framework-on-centos-7.jpg 542w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-framework-on-centos-7-300x99.jpg 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-framework-on-centos-7-150x49.jpg 150w\" sizes=\"(max-width: 542px) 100vw, 542px\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p>Django is built and maintained by experienced developers and used by some of the world\u2019s biggest companies and governments. Also, some of the most popular websites such as Instagram, Mozilla, Pinterest, The Washington Times, and Disqus are using Django. Installing Django on CentOS 7 is a fairly easy task if you follow the steps below carefully.<\/p>\r\n\r\n\r\n\r\n<p><!--more--><\/p>\r\n\r\n\r\n\r\n<p>There are several ways to install Django on a CentOS machine.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Install from <a href=\"https:\/\/www.rosehosting.com\/blog\/list-installed-packages-and-query-package-information-with-yum\/\">yum packages<\/a><\/li>\r\n<li>Install through pip<\/li>\r\n<li>Install through pip in a virtual environment<\/li>\r\n<li>Install from Git<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>This time, we will install Django with pip in a virtual environment.<\/p>\r\n\r\n\r\n\r\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69f4d4304aa60\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69f4d4304aa60\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#Step-1-Login-to-the-server-and-update\" >Step 1: Login to the server and update<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#Step-2-Enable-EPEL-repository\" >Step 2: Enable EPEL repository<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#Step-3-Install-Python-and-pip\" >Step 3: Install Python and pip<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#Step-4-Install-virtual-environment\" >Step 4: Install virtual environment<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#Step-5-Create-a-virtual-environment\" >Step 5: Create a virtual environment<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#Step-6-Install-Django-in-virtualenv\" >Step 6: Install Django in virtualenv<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#Step-7-Create-a-Django-project\" >Step 7: Create a Django project<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-prerequisites\"><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<p>CentOS 7 based VPS<br \/>SSH access with root privileges<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-step-1-login-to-the-server-and-update\"><span class=\"ez-toc-section\" id=\"Step-1-Login-to-the-server-and-update\"><\/span>Step 1: Login to the server and update<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<p>ssh root@IP_Address -p Port_number<br \/>yum update<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-step-2-enable-epel-repository\"><span class=\"ez-toc-section\" id=\"Step-2-Enable-EPEL-repository\"><\/span>Step 2: Enable EPEL repository<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<p>yum install epel-release<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-step-3-install-python-and-pip\"><span class=\"ez-toc-section\" id=\"Step-3-Install-Python-and-pip\"><\/span>Step 3: Install Python and pip<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<p>yum install python-devel python-setuptools python-pip<br \/>pip install &#8211;upgrade pip<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-step-4-install-virtual-environment\"><span class=\"ez-toc-section\" id=\"Step-4-Install-virtual-environment\"><\/span>Step 4: Install virtual environment<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<p>pip install virtualenv<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-step-5-create-a-virtual-environment\"><span class=\"ez-toc-section\" id=\"Step-5-Create-a-virtual-environment\"><\/span>Step 5: Create a virtual environment<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<p>We will install a virtual environment on a system user, if you don&#8217;t have a system user other than root, please create one first. In this example, we will use a system user called &#8220;rose&#8221;.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">su - rose\r\ncd ~\r\nvirtualenv django<\/pre>\r\n\r\n\r\n\r\n<p>The command will create a virtual environment in \/home\/rose\/django<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-step-6-install-django-in-virtualenv\"><span class=\"ez-toc-section\" id=\"Step-6-Install-Django-in-virtualenv\"><\/span>Step 6: Install Django in virtualenv<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<p>Still as user &#8220;rose&#8221;, we are now going to install Django in the virtual environment we created earlier<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">source ~\/django\/bin\/activate<\/pre>\r\n\r\n\r\n\r\n<p>As you can see on the screen, your SSH terminal prompt is changed<\/p>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"493\" height=\"95\" class=\"wp-image-36194\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/installing-django-on-centos-7.png\" alt=\"installing django on centos 7\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/installing-django-on-centos-7.png 493w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/installing-django-on-centos-7-300x58.png 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/installing-django-on-centos-7-150x29.png 150w\" sizes=\"(max-width: 493px) 100vw, 493px\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p>You are now in the virtual environment, let&#8217;s proceed with Django installation<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">pip install django<\/pre>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-step-7-create-a-django-project\"><span class=\"ez-toc-section\" id=\"Step-7-Create-a-Django-project\"><\/span>Step 7: Create a Django project<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<p>Django has been installed under user &#8220;rose&#8221;, now let&#8217;s create a project<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">cd ~\r\ndjango-admin startproject one<\/pre>\r\n\r\n\r\n\r\n<p>The command will create a project named &#8220;one&#8221;, and this will also create a &#8220;one&#8221; directory in \/home\/rose\/<br \/>Next, run the following commands to start the new project<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">cd one\r\npython manage.py migrate\r\npython manage.py createsuperuser\r\npython manage.py runserver 0.0.0.0:8000<\/pre>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"556\" height=\"566\" class=\"wp-image-36195\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/guide-to-installing-django-on-centos-7.png\" alt=\"guide to installing django on centos 7\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/guide-to-installing-django-on-centos-7.png 556w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/guide-to-installing-django-on-centos-7-295x300.png 295w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/guide-to-installing-django-on-centos-7-147x150.png 147w\" sizes=\"(max-width: 556px) 100vw, 556px\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p>When creating the superuser, you will be asked for a password and email, please provide them with the credentials as you wish.<\/p>\r\n\r\n\r\n\r\n<p>Now, open your favorite web browser and navigate to your IP_address:8000. In this example, we install Django on 192.168.1.231 so we need to go to http:\/\/192.168.1.231:8000<\/p>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"857\" height=\"264\" class=\"wp-image-36198\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7.png\" alt=\"how to install django on centos 7\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7.png 857w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7-300x92.png 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7-150x46.png 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7-768x237.png 768w\" sizes=\"(max-width: 857px) 100vw, 857px\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p>If you see an error message like the following, then you need to edit the ALLOWED_HOSTS value in settings.py file<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">DisallowedHost at \/ Invalid HTTP_HOST header: '192.168.1.231'. You may need to add u'192.168.1.231' to ALLOWED_HOSTS.<\/pre>\r\n\r\n\r\n\r\n<p>To edit the ALLOWED_HOSTS value in settings.py file, you can run the following command.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">nano ~\/one\/one\/settings.py<\/pre>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">ALLOWED_HOSTS = ['192.168.1.231','127.0.0.1','yourdomain.com']<\/pre>\r\n\r\n\r\n\r\n<p>Save the file and exit, then rerun the application again:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">python manage.py runserver 0.0.0.0:8000<\/pre>\r\n\r\n\r\n\r\n<p>You can reach Django administration page at http:\/\/192.168.1.231:8000\/admin, use the credentials you chose when creating Django superuser<\/p>\r\n\r\n\r\n\r\n<p>To manage the Django application better, we need to install gunicorn. Gunicorn is a python web server gateway interface HTTP server. It is a pre-fork worker model, ported from Ruby&#8217;s Unicorn project. The Gunicorn server is broadly compatible with a number of web frameworks, simply implemented, light on server resources, and fairly fast.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">pip install gunicorn\r\ndeactivate\r\nexit<\/pre>\r\n\r\n\r\n\r\n<p>Now we will create a systemd service file to start and stop the application server.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">nano \/etc\/systemd\/system\/gunicorn.service<\/pre>\r\n\r\n\r\n\r\n<p>Then, insert the following lines to the systemd service file.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">[Unit]\r\nDescription=gunicorn daemon\r\nAfter=network.target\r\n\r\n[Service]\r\nUser=rose\r\nGroup=nginx\r\nWorkingDirectory=\/home\/rose\/one\r\nExecStart=\/home\/rose\/django\/bin\/gunicorn --access-logfile - --workers 3 --bind unix:\/home\/rose\/one\/one.sock one.wsgi:application\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n<\/pre>\r\n\r\n\r\n\r\n<p>Save and exit nano, then issue the following command to reload systemd service file.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">systemctl daemon-reload<\/pre>\r\n\r\n\r\n\r\n<p>Now, we can start-stop-restart Django application using systemctl command<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">systemctl start gunicorn<\/pre>\r\n\r\n\r\n\r\n<p>If you want to run it on boot, we need to enable it<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">systemctl enable gunicorn<\/pre>\r\n\r\n\r\n\r\n<p>Gunicorn has been successfully configured, now if you want to access the application using your domain name and remove the port number in your favorite web browser address bar, we need to install and configure a webserver. This time, we will install and configure nginx to proxy pass to gunicorn.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">yum install nginx<\/pre>\r\n\r\n\r\n\r\n<p>Let&#8217;s create an nginx server block file, make sure you change yourdomain.com to your actual domain name.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">nano \/etc\/nginx\/conf.d\/yourdomain.com.conf<\/pre>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">server {\r\nlisten 80;\r\nserver_name yourdomain.com;\r\n\r\nlocation = \/favicon.ico { access_log off; log_not_found off; }\r\nlocation \/static\/ {\r\nroot \/home\/rose\/one;\r\n}\r\n\r\nlocation \/ {\r\nproxy_set_header Host $http_host;\r\nproxy_set_header X-Real-IP $remote_addr;\r\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\nproxy_set_header X-Forwarded-Proto $scheme;\r\nproxy_pass http:\/\/unix:\/home\/rose\/one\/one.sock;\r\n}\r\n}\r\n<\/pre>\r\n\r\n\r\n\r\n<p>Save and exit once finished.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">nginx -t&lt;\/pre<\/pre>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">systemctl start nginx\r\nsystemctl enable nginx<\/pre>\r\n\r\n\r\n\r\n<p>To give permissions to nginx to access your Django application, we have to add nginx user to a user group that run Django<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">usermod -a -G rose nginx<\/pre>\r\n\r\n\r\n\r\n<p>Then, we also need to change the directory permission of Django user&#8217;s home.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">chmod 710 \/home\/rose<\/pre>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">systemctl restart nginx<\/pre>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"alignright is-resized\"><img decoding=\"async\" class=\"wp-image-36412\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-framework-on-centos-7.jpg\" alt=\"how to install django framework on centos 7\" width=\"271\" height=\"89\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-framework-on-centos-7.jpg 542w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-framework-on-centos-7-300x99.jpg 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-framework-on-centos-7-150x49.jpg 150w\" sizes=\"(max-width: 271px) 100vw, 271px\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p>That&#8217;s it, you should be able to access your Django application at http:\/\/yourdomain.com now.<\/p>\r\n\r\n\r\n\r\n<p>Of course, you don\u2019t have to Install Django on CentOS 7 if you use one of our <a href=\"https:\/\/www.rosehosting.com\/django-hosting.html\">Django VPS Hosting <\/a>plans, in which case you can simply ask our expert Linux admins to install Django on your CentOS VPS for you. They are available 24\/7 and will take care of your request immediately.<\/p>\r\n\r\n\r\n\r\n<p>PS. If you liked this post on how to install Django on CentOS 7, please share it with your friends on the social networks or simply leave a reply in the comments sections. Thanks.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we will show you how to install Django on CentOS 7. Django is a free and open-source, &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to Install Django on CentOS 7\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#more-27860\" aria-label=\"Read more about How to Install Django on CentOS 7\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":37148,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1699,13],"tags":[541,862,172],"class_list":["post-27860","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-tutorials","tag-centos-7","tag-django","tag-install","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.5 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Install Django on CentOS 7 | RoseHosting<\/title>\n<meta name=\"description\" content=\"Are you looking for a complete guide on how to install Django on CentOS 7? Click here for a step-by-step guide from RoseHosting.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install Django on CentOS 7 | RoseHosting\" \/>\n<meta property=\"og:description\" content=\"Are you looking for a complete guide on How to Install Django on CentOS 7? Click here for a step-by-step guide from RoseHosting.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-09T17:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-03T08:31:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7.jpg?v=1622098021\" \/>\n\t<meta property=\"og:image:width\" content=\"742\" \/>\n\t<meta property=\"og:image:height\" content=\"372\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Install Django on CentOS 7 | RoseHosting\" \/>\n<meta name=\"twitter:description\" content=\"Are you looking for a complete guide on how to install Django on CentOS 7? Click here for a step-by-step guide from RoseHosting.\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-django-on-centos-7\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-django-on-centos-7\\\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How to Install Django on CentOS 7\",\"datePublished\":\"2021-06-09T17:30:00+00:00\",\"dateModified\":\"2022-06-03T08:31:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-django-on-centos-7\\\/\"},\"wordCount\":782,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-django-on-centos-7\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/how-to-install-django-on-centos-7.jpg\",\"keywords\":[\"centos 7\",\"django\",\"install\"],\"articleSection\":[\"CentOS\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-django-on-centos-7\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-django-on-centos-7\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-django-on-centos-7\\\/\",\"name\":\"How to Install Django on CentOS 7 | RoseHosting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-django-on-centos-7\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-django-on-centos-7\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/how-to-install-django-on-centos-7.jpg\",\"datePublished\":\"2021-06-09T17:30:00+00:00\",\"dateModified\":\"2022-06-03T08:31:39+00:00\",\"description\":\"Are you looking for a complete guide on how to install Django on CentOS 7? Click here for a step-by-step guide from RoseHosting.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-django-on-centos-7\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-django-on-centos-7\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-django-on-centos-7\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/how-to-install-django-on-centos-7.jpg\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/how-to-install-django-on-centos-7.jpg\",\"width\":742,\"height\":372,\"caption\":\"how to install django on centos 7\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-django-on-centos-7\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install Django on CentOS 7\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/RoseHosting\",\"https:\\\/\\\/x.com\\\/rosehosting\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/rosehosting\\\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\\\/\\\/www.rosehosting.com\",\"https:\\\/\\\/www.facebook.com\\\/rosehosting.helpdesk\"],\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/author\\\/jwilson\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Install Django on CentOS 7 | RoseHosting","description":"Are you looking for a complete guide on how to install Django on CentOS 7? Click here for a step-by-step guide from RoseHosting.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/","og_locale":"en_US","og_type":"article","og_title":"How to Install Django on CentOS 7 | RoseHosting","og_description":"Are you looking for a complete guide on How to Install Django on CentOS 7? Click here for a step-by-step guide from RoseHosting.","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2021-06-09T17:30:00+00:00","article_modified_time":"2022-06-03T08:31:39+00:00","og_image":[{"width":742,"height":372,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7.jpg?v=1622098021","type":"image\/jpeg"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_title":"How to Install Django on CentOS 7 | RoseHosting","twitter_description":"Are you looking for a complete guide on how to install Django on CentOS 7? Click here for a step-by-step guide from RoseHosting.","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How to Install Django on CentOS 7","datePublished":"2021-06-09T17:30:00+00:00","dateModified":"2022-06-03T08:31:39+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/"},"wordCount":782,"commentCount":0,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7.jpg","keywords":["centos 7","django","install"],"articleSection":["CentOS","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/","name":"How to Install Django on CentOS 7 | RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7.jpg","datePublished":"2021-06-09T17:30:00+00:00","dateModified":"2022-06-03T08:31:39+00:00","description":"Are you looking for a complete guide on how to install Django on CentOS 7? Click here for a step-by-step guide from RoseHosting.","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/08\/how-to-install-django-on-centos-7.jpg","width":742,"height":372,"caption":"how to install django on centos 7"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-django-on-centos-7\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Install Django on CentOS 7"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/27860","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=27860"}],"version-history":[{"count":26,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/27860\/revisions"}],"predecessor-version":[{"id":41068,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/27860\/revisions\/41068"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/37148"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=27860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=27860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=27860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}