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
- 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:
Install Django 1.11.17
- Navigate to your virtual environment.
- Install django 1.11.17 library into the virtual environment. (See How to find out your installled Django version)
pip 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
- Select Tools->Run manage.py Task
- In the window that opens at the bottom, type:
- Open a browser and enter 127.0.0.1 into the URL bar. You should see the following. If so then congratulations, you’ve set up a Django project environment.
(See why to use ‘manage.py runserver’ as opposed to ‘django-admin runserver’)