Django is a free, open-source program that streamlines Python programming to help developers create “clean, pragmatic design.”
The virtual private server needs to be equipped with Python before Django can be installed. The recommended installation method is to create an isolated Python environment, called a virtualenv, where any changes made to the overall virtual server will not affect the Python projects. An additional benefit of using virtualenv is that it does not require root access to install or manage. Django itself can then be installed within the virtualenv with the help of Pip, a tool that makes installation, upgrades, and removals of Python Packages extremely easy.
You can install Pip on Ubuntu through apt-get:
- sudo apt-get install python-pip
Go ahead and install Python:
- curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py
Once that process has completed, we need to create the new virtualenv.
- python virtualenv.py example_env
The next step is to activate the virtualenv so that all further changes and installations will be done only within example_env
- . example_env/bin/activate
In the previous step, we setup the environment to install Django. Now using the easy pip installer, we can get Django on our droplet.
- pip install Django
For future reference, you can use these commands to make changes to your version of Django or any other Python packages:
- pip install --upgrade Django
- pip uninstall Django
You now have Django installed on your VPS!
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.Sign up
Click below to sign up and get $100 of credit to try our products over 60 days!