- If you are new to Django, check out the official Django tutorial at https://docs.djangoproject.com/en/dev/intro/tutorial01/ and then return to this recipe.
- Create a Python virtualenv (http://www.virtualenv.org/en/latest/) to create an isolated Python environment to use with the web application you will build in this recipe and the next. Then, activate the environment as follows:
-
- Use the following commands in Linux:
$ cd ~/virtualenvs/
$ virtualenv --no-site-packages chp09-env
$ source chp09-env/bin/activate
cd c:\virtualenvs
C:\Python27\Scripts\virtualenv.exe
-no-site-packages chp09-env
chp09-env\Scripts\activate
- Once activated, you can install the Python packages that you will use for this recipe as well as the next, using the pip tool (http://www.pip-installer.org/en/latest/).
-
- In Linux, the command would be as follows:
(chp09-env)$ pip install django==1.10
(chp09-env)$ pip install psycopg2==2.7
(chp09-env)$ pip install Pillow
-
- In Windows, the command would be as follows:
(chp09-env) C:\virtualenvs> pip install django==1.10
(chp09-env) C:\virtualenvs> pip install psycopg2=2.7
(chp09-env) C:\virtualenvs> easy_install Pillow
- If you haven't done it so far, download the world countries shapefile from http://thematicmapping.org/downloads/TM_WORLD_BORDERS-0.3.zip. A copy of this shapefile is included in the code bundle of this book. Extract the shapefile to the working/chp09 directory.