{"id":14282,"date":"2022-08-15T07:33:03","date_gmt":"2022-08-15T06:33:03","guid":{"rendered":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?p=14282"},"modified":"2023-03-02T12:09:05","modified_gmt":"2023-03-02T12:09:05","slug":"install-django-framework","status":"publish","type":"post","link":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/install-django-framework\/","title":{"rendered":"How To Install Django Framework?"},"content":{"rendered":"\n<p>Django is a very popular framework used for writing Python web applications. It lets you build applications very fast without worrying about the common structural code. This framework lets you focus more on the application, and allow the tools to do the heavy tasks.&nbsp;If you need to install Django on a CentOs7 machine, then there are different methods from which you can choose.&nbsp;<\/p>\n\n\n\n<p>In this guide, we will get to know the different methods to install Django through pip in Virtual Environment (Virtualenv).<\/p>\n\n\n\n<p>First you need to EPEL repository. The installation methods depend on the EPEL repository for RedHat distributions and CentOS. The EPEL repository consists of the extra packages that are not maintained and are a part of the core distributions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing the EPEL Repository <\/h2>\n\n\n\n<p>It\u2019s simple to install the EPEL repository. All you need to do is first configure <strong>yum<\/strong> to use the EPEL repository by typing:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo yum install epel-release<\/pre>\n\n\n\n<p>You will now get the access to all the applications that are maintained within the EPEL repository.<\/p>\n\n\n\n<h4 style=\"background-color: #D5EAFF; padding: 10px;\">Check out our <a href=\"https:\/\/www.milesweb.co.uk\/hosting\/django-hosting\" target=\"_blank\" rel=\"noopener\">Best Django Hosting<\/a> Plans!<\/h4>\n\n\n\n<p>Let\u2019s see the method to install the Django framework through pip3 in Virtual env:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Django Installation Through pip in Virtualenv<\/h2>\n\n\n\n<p>One of the easy way to install Django on your system is through the <strong><em>virtualenv <\/em><\/strong>tool. This tool lets you create virtual python environments where you can install any Python packages you want to install without having any effect on the system. This lets you choose the Python packages on your project requirements.<\/p>\n\n\n\n<p>We will first begin by installing <strong><em>pip <\/em><\/strong>from the EPEL repository:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">yum install epel-release yum-utils -y<\/pre>\n\n\n\n<p>Then, install Python and pip using the command given below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">yum install python3-pip -y<\/pre>\n\n\n\n<p>Once pip is installed, you can use it to install the virtual package with the below command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pip3 install Virtualenv<\/pre>\n\n\n\n<p>When you want to start with a new project, you can just create a virtual environment for it. You can start by creating and moving it into a new project directory, by using the command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir ~\/newproject\ncd ~\/newproject<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Creating New Project in Virtual Environment<\/h2>\n\n\n\n<p>This is how you can create new project in virtual environment:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">virtualenv newproject <\/pre>\n\n\n\n<p>To install packages into the isolated environment, you must first activate the new source project. To do so, type in the below command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">source newproject\/bin\/activate<\/pre>\n\n\n\n<p>Your command prompt need to reflect that you are in your virtual environment. In your new virtual environment, you can use pip3 to install Django. Make sure you do not use sudo as you are installing it locally.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pip3 install Django<\/pre>\n\n\n\n<p>You can also verify the installation by typing:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">django-admin \u2013version\n3.2.14<\/pre>\n\n\n\n<p>To leave the virtual environment, you need to use the deactivate command from thee system:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Deactivate<\/pre>\n\n\n\n<p>If you want to work on your project again, you can revert back anytime. All you need to do is, reactivate your virtual environment by moving back into your project directory, and enter command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd ~\/newproject\n\nsource newenv\/bin\/activate<\/pre>\n\n\n\n<p>After this, you can navigate to the code directory on your Desktop and create asimple <strong><em>helloworld <\/em><\/strong>directory with the commands given below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># Windows\n&gt; cd onedrive\\desktop\\code\n&gt; mkdir helloworld\n&gt; cd helloworld\n\n# macOS\n% cd ~\/desktop\/code\n% mkdir helloworld\n% cd helloworld<\/pre>\n\n\n\n<p>Then, create a new virtual environment named as, <strong>.venv. <\/strong>First activate it, and install Django with <strong>Pip<\/strong>3.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># Windows\n&gt; python -m venv .venv\n&gt; .venv\\Scripts\\Activate.ps1\n(.venv) &gt; python -m pip3 install django~=3.2.14\n\n# macOS\n% python3 -m venv .venv\n% source .venv\/bin\/activate\n(.venv) % python3 -m pip install django~=3.2.14<\/pre>\n\n\n\n<p><strong>Conclusion<\/strong> This is how you can install Django with Pip3 using the virtual environment. By using a powerful framework like Django, can help to make the web development faster, and let you concentrate on the main aspects of your applications.<\/p>\n\n\n\n<p><strong>Read More: <a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-deploy-python-django-application\/\" target=\"_blank\" rel=\"noreferrer noopener\">Know How to Deploy Python Django Application?<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Django is a very popular framework used for writing Python web applications. It lets you build applications very fast without worrying about the common structural code. This framework lets you focus more on the application, and allow the tools to do the heavy tasks.&nbsp;If you need to install Django on a CentOs7 machine, then there [&hellip;]<\/p>\n","protected":false},"author":34,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[2919],"class_list":["post-14282","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-howtos","tag-django-framework"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Install Django Framework? | MilesWeb<\/title>\n<meta name=\"description\" content=\"Django is a popular framework. You can install Django through different methods. This guide helps you to know the installation of Django through pip3 in virtual environment.\" \/>\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.milesweb.co.uk\/hosting-faqs\/install-django-framework\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Install Django Framework? | MilesWeb\" \/>\n<meta property=\"og:description\" content=\"Django is a popular framework. You can install Django through different methods. This guide helps you to know the installation of Django through pip3 in virtual environment.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/install-django-framework\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-15T06:33:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-02T12:09:05+00:00\" \/>\n<meta name=\"author\" content=\"Nehal Khatri\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nehal Khatri\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/install-django-framework\/\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/install-django-framework\/\",\"name\":\"How To Install Django Framework? | MilesWeb\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\"},\"datePublished\":\"2022-08-15T06:33:03+00:00\",\"dateModified\":\"2023-03-02T12:09:05+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/0241ea191f60975839d956b6952e0a1d\"},\"description\":\"Django is a popular framework. You can install Django through different methods. This guide helps you to know the installation of Django through pip3 in virtual environment.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/install-django-framework\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/install-django-framework\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/install-django-framework\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Install Django Framework?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/0241ea191f60975839d956b6952e0a1d\",\"name\":\"Nehal Khatri\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/736396ef8d8bdecec53ce8851058903e?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/736396ef8d8bdecec53ce8851058903e?s=96&d=blank&r=g\",\"caption\":\"Nehal Khatri\"},\"description\":\"Nehal is an ardent content writer. She's passionate about crafting content that's simple but adds value. Her insatiable interest in writing has allowed her to explore her skills. She is adept and can write for different types of content formats.\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/nehal-khatri\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Install Django Framework? | MilesWeb","description":"Django is a popular framework. You can install Django through different methods. This guide helps you to know the installation of Django through pip3 in virtual environment.","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.milesweb.co.uk\/hosting-faqs\/install-django-framework\/","og_locale":"en_GB","og_type":"article","og_title":"How To Install Django Framework? | MilesWeb","og_description":"Django is a popular framework. You can install Django through different methods. This guide helps you to know the installation of Django through pip3 in virtual environment.","og_url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/install-django-framework\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2022-08-15T06:33:03+00:00","article_modified_time":"2023-03-02T12:09:05+00:00","author":"Nehal Khatri","twitter_misc":{"Written by":"Nehal Khatri","Estimated reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/install-django-framework\/","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/install-django-framework\/","name":"How To Install Django Framework? | MilesWeb","isPartOf":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website"},"datePublished":"2022-08-15T06:33:03+00:00","dateModified":"2023-03-02T12:09:05+00:00","author":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/0241ea191f60975839d956b6952e0a1d"},"description":"Django is a popular framework. You can install Django through different methods. This guide helps you to know the installation of Django through pip3 in virtual environment.","breadcrumb":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/install-django-framework\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.co.uk\/hosting-faqs\/install-django-framework\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/install-django-framework\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"How To Install Django Framework?"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/0241ea191f60975839d956b6952e0a1d","name":"Nehal Khatri","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/736396ef8d8bdecec53ce8851058903e?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/736396ef8d8bdecec53ce8851058903e?s=96&d=blank&r=g","caption":"Nehal Khatri"},"description":"Nehal is an ardent content writer. She's passionate about crafting content that's simple but adds value. Her insatiable interest in writing has allowed her to explore her skills. She is adept and can write for different types of content formats.","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/nehal-khatri\/"}]}},"views":151,"_links":{"self":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/14282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/users\/34"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=14282"}],"version-history":[{"count":4,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/14282\/revisions"}],"predecessor-version":[{"id":14753,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/14282\/revisions\/14753"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=14282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=14282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=14282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}