Installing Django on Windows
Django is a Python web framework which allows rapid development of website by following the Model-View-Controller architecture.
To install Django, definitely you need to have python installed first. If you haven’t, download it from the official website here.
After python is installed, the recommended way of installing django is to use virtualenv to manage the django installation. Therefore, you need to have virtualenv installed first. Here goes for the steps:
Install setuptools (required by pip).
- Download Windows installer from http://www.lfd.uci.edu/~gohlke/pythonlibs/#setuptools
- Run the installer to install setuptools.
Install pip (used to install python packages).
- Download Windows installer from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pip
- Run the installer to install pip.
Install virtualenv.
In the command prompt, run:
pip install virtualenv
If the error “pip command not found” occurs, check that the python script directory is in your $PATH environment variable. The typical script directory for Python 2.7 is
C:\Python27\Scripts
.
Setup your virtual environment.
- In the command prompt, run virtualenv my_env . Replace my_env with the folder where you want the virtual environment files to be generated
- Then, run my_env\Scripts\activate.bat to activate your virtual environment.
Install Django.
- Now, you are in your virtual environement, and you will see a ’(my_env)’ prefix on your command prompt. If you couldn’t find the prefix, check that you have executed the previous step correctly and you are using the same command prompt.
In the command prompt, run:
pip install django
You have completed your Django installation on a virtual environment for your project. You can now continue to develop using Django!
comments powered by Disqus