Django 1.11.17 Tutorial (part 1) – Create Environment

The Django Polls tutorial is the ideal way to learn Django. It is an excellent tutorial and covers most bases. This post series summarizes the tutorial. The purpose of the summary to allow me to revise what I learned in the Django Polls tutorial, and take the tutorial material and quickly create my own webapp.

I know that later I will want to integrate my Polls (or other Django webapp) with Django CMS. I discovered that Django CMS didn’t work well with Django 2.x and Python 3.7 at the time of writing. So this tutorial will step through installation of Django 1.11.17. My IDE is PyCharm Pro.

Setting Up Django 1.11.17 For Use In PyCharm Pro

Prerequisites

  • Python 3.6.x
  • VirtualEnv Library.
  • VirtualEnvWrapper Library

Create Your Virtual Environment

I use virtualenvwrapper commands to easily create a virtual environment. The “WORKON_HOME” environment variable mentioned below is required for virtualenvwrapper.
 

  • Create your virtual environment directory location.
    This is just a folder you manually create where you will keep your virtual environments. Generally it would seem (from various googled sources) that this should not be within your project folder tree. I just made a location adjacent to my projects (In my case, this happens to be: F:\2_OWN_TECH\Projects-Python\venv).
     
  • Set WORKON_HOME environment variable to your virtual environment folder (eg. F:\2_OWN_TECH\Projects-Python\venv). If you don’t set this environment variable, virtualenvwrapper will create your virtual environments in your user directory. This doesn’t suit me, which is why I set this environment variable. It is merely a preference and is up to the user.
  • Make a virtual environment inside yourvirtual environment folder (F:\2_OWN_TECH\Projects-Python\venv) as follows:
     c:\>mkvirtualenv mysite

Install Django 1.11.17

Create A Django Project

  • Navigate into a directory where you’d like to store your code, then run the following command:
    django-admin startproject mysite

Launch PyCharm Pro

From here forward I used PycharmPro.

  • Start PyCharm and select “open project”.
  • Choose the mysite project.
  • Click menu File->Settings and check that the project interpreter is set to your virtual environment that you created. Check that Django version 1.11.17 is the installed version.(See how to find out your django version using the command line.)

Check It Works – Start The WebServer

Pin It on Pinterest

Share This