{"id":237,"date":"2017-12-09T03:45:00","date_gmt":"2017-12-09T02:45:00","guid":{"rendered":"https:\/\/kindsonthegenius.com\/blog\/2017\/12\/09\/how-to-setup-django-2-0-on-python-3-6-using-virtualenv-and-pip\/"},"modified":"2020-08-22T10:28:29","modified_gmt":"2020-08-22T08:28:29","slug":"how-to-setup-django-2-0-on-python-3-6-using-virtualenv-and-pip","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/blog\/how-to-setup-django-2-0-on-python-3-6-using-virtualenv-and-pip\/","title":{"rendered":"How to Setup Django 2.0 on Python 3.6 using virtualenv and pip"},"content":{"rendered":"<p>In this lesson, I will show you how to install Python 3.6 and set up Django 2.0 in 6 easy steps using virtualenv and pip.<\/p>\n<div style=\"clear: both; text-align: center;\"><\/div>\n<p><ins style=\"display: block; text-align: center;\" data-ad-client=\"ca-pub-7041870931346451\" data-ad-format=\"fluid\" data-ad-layout=\"in-article\" data-ad-slot=\"4209786523\"><\/ins> \u00a0 <b>Step 1: Download and Install Python <\/b><br \/>\nDownload the Python 3.6.3 from the website link below<br \/>\n<a href=\"https:\/\/www.python.org\/downloads\/windows\/\"><i>https:\/\/www.python.org\/downloads\/windows\/<\/i><\/a><br \/>\nMake sure you choose the installer that matches your operating system whether 32 or 64bit.<br \/>\nCreate a folder in drive C or D and call it python36<\/p>\n<p>Run the installation. Choose custom installation and make sure the following is selected:<\/p>\n<ul>\n<li>Install for all users<\/li>\n<li>Add Python the environment variables<\/li>\n<li>Create shortcuts for installed applications<\/li>\n<li>Precompiled standard library<\/li>\n<\/ul>\n<p>Install python to the folder python36 that you created.<\/p>\n<p>&nbsp;<\/p>\n<p><ins style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-7041870931346451\" data-ad-slot=\"4209786523\"><\/ins> <b>Step 2: Create a Workspace (Folder)<\/b><br \/>\nJust create another folder in your drive C or D and call it workspace<br \/>\n(you can also use another name)<\/p>\n<p>&nbsp;<\/p>\n<p><b>Step 3: Install virtualenv<\/b><br \/>\nThis is a tool that helps you create something similar to a web server. To install virtualenv:<br \/>\nOpen Windows PowerShell(run as Admnistrator) and enter the command:<br \/>\n<i>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: #0b5394;\">pip install virtualenv<\/span><\/i><\/p>\n<p>&nbsp;<\/p>\n<p><b>Step 4: Create a Folder to Keep you Websites<\/b><br \/>\nTo create this folder (here I call it local_sites):<br \/>\nNavigate to the Workspace folder you created and run the command:<br \/>\n<span style=\"color: #0b5394;\"><i>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 virtualenv local_sites<\/i><\/span><\/p>\n<p>&nbsp;<br \/>\nThis commands creates the folder.<br \/>\nYou can go the location of your workspace from &#8216;My Computer&#8217; to verify that the virtual environment have been created. You can open it and verify it contains the items as shown below:<\/p>\n<div style=\"color: #555555; font-family: 'segoe ui'; font-size: 18px;\">\n<figure style=\"width: 640px\" class=\"wp-caption aligncenter\"><a style=\"margin-left: auto; margin-right: auto;\" href=\"https:\/\/4.bp.blogspot.com\/-CtHUyYftHRU\/WitWxpFIHhI\/AAAAAAAAAaQ\/iBN6iAkYYmAxBNkzH7PW03ccqQy6eQjsQCLcBGAs\/s1600\/Virtual-Environment-virtualenv-Content.JPG\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/4.bp.blogspot.com\/-CtHUyYftHRU\/WitWxpFIHhI\/AAAAAAAAAaQ\/iBN6iAkYYmAxBNkzH7PW03ccqQy6eQjsQCLcBGAs\/s640\/Virtual-Environment-virtualenv-Content.JPG\" alt=\"\" width=\"640\" height=\"505\" border=\"0\" data-original-height=\"597\" data-original-width=\"754\" \/><\/a><figcaption class=\"wp-caption-text\">Content of the local_sites folder created by the virtualenv command<\/figcaption><\/figure>\n<\/div>\n<p>&nbsp;<\/p>\n<p><b>Step 5: Activate the Development Environment<\/b><br \/>\n\u00a0This means that the folder becomes a web folder such that the web pages inside can be access from your browser over HTTP<br \/>\nTo\u00a0 activate the virtualenv, in the command prompt, navigate to the script directory and run the command<br \/>\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #0b5394;\"> .<i>activate<\/i><\/span><\/p>\n<div style=\"font-family: 'segoe ui';\">\n<div style=\"color: #555555; font-family: 'segoe ui'; font-size: 18px;\"><b>Step 6: Install Django 2.0<\/b><\/div>\n<div style=\"color: #555555; font-family: 'segoe ui'; font-size: 18px;\">Still in the same prompt, install Django 2.0 by running the command:<\/div>\n<div style=\"color: #555555; font-family: 'segoe ui'; font-size: 18px;\">\u00a0 \u00a0 \u00a0<span style=\"color: #0b5394;\"><i>pip install django==2.0<\/i><\/span><\/div>\n<div style=\"color: #555555; font-family: 'segoe ui'; font-size: 18px;\">\u00a0If everything was done correctly, then you you look at the screenshot below to verify you got it right.<\/div>\n<div style=\"color: #555555; font-family: 'segoe ui'; font-size: 18px;\">Congratulations! You are now ready to create your first website in Python.<\/div>\n<div style=\"color: #555555; font-family: 'segoe ui'; font-size: 18px;\">If you had any issue with this set up, let me know in the comment box below<\/div>\n<p>&nbsp;<\/p>\n<div style=\"color: #555555; font-family: 'segoe ui'; font-size: 18px;\">\n<figure style=\"width: 640px\" class=\"wp-caption aligncenter\"><a style=\"margin-left: auto; margin-right: auto;\" href=\"https:\/\/4.bp.blogspot.com\/-GG-mJA5gqo8\/WitXRMCIahI\/AAAAAAAAAaY\/pwj3HPQrNKcVfRTkAgDA2naghwVY9UPGwCLcBGAs\/s1600\/Setting-up-Python-36-with-With-Django-20.JPG\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/4.bp.blogspot.com\/-GG-mJA5gqo8\/WitXRMCIahI\/AAAAAAAAAaY\/pwj3HPQrNKcVfRTkAgDA2naghwVY9UPGwCLcBGAs\/s640\/Setting-up-Python-36-with-With-Django-20.JPG\" alt=\"\" width=\"640\" height=\"412\" border=\"0\" data-original-height=\"642\" data-original-width=\"997\" \/><\/a><figcaption class=\"wp-caption-text\">The red text shows I made two errors along the line but corrected it. Can you figure them out? If you can write it on the comment box below.<\/figcaption><\/figure>\n<\/div>\n<p>&nbsp;<\/p>\n<div style=\"color: #555555; font-family: 'segoe ui'; font-size: 18px;\"><b>Summary<\/b><\/div>\n<div style=\"color: #555555; font-family: 'segoe ui'; font-size: 18px;\">You have learnt how to install Python 3.6 and set up Django 2.0 using virtualenv and pip<\/div>\n<div style=\"color: #555555; font-family: 'segoe ui'; font-size: 18px;\">Watch the video tutorial <a href=\"https:\/\/youtu.be\/0FucK4ggK7Q\">here<\/a>:<\/div>\n<p><a href=\"https:\/\/youtu.be\/0FucK4ggK7Q\">Vidoe Tutorial: How to Setup Python 3.6 and Django 2.0 using pip and virtualenv<\/a><br \/>\n<\/span><\/span><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this lesson, I will show you how to install Python 3.6 and set up Django 2.0 in 6 easy steps using virtualenv and pip. &hellip; <\/p>\n","protected":false},"author":2,"featured_media":759,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/237"}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/comments?post=237"}],"version-history":[{"count":5,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/237\/revisions"}],"predecessor-version":[{"id":758,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/237\/revisions\/758"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media\/759"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media?parent=237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/categories?post=237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/tags?post=237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}