Report this

What is the reason for this report?

How To Install Django

Published on June 4, 2012
How To Install Django

Django

Django is a free, open-source program that streamlines Python programming to help developers create “clean, pragmatic design.”

Step One — Install Python and Pip

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:

  1. sudo apt-get install python-pip

Go ahead and install Python:

  1. curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py

Once that process has completed, we need to create the new virtualenv.

  1. 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

  1. . example_env/bin/activate

Step Two — Install Django

In the previous step, we setup the environment to install Django. Now using the easy pip installer, we can get Django on our droplet.

  1. pip install Django

For future reference, you can use these commands to make changes to your version of Django or any other Python packages:

  1. pip install --upgrade Django
  1. pip uninstall Django

You now have Django installed on your VPS!

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author

Etel Sverdlov
Etel Sverdlov
Author
See author profile

Former Director of Community at DigitalOcean. Expert in cloud topics including LAMP Stack, CentOS, Ubuntu, MySQL, SSL certificates, and more.

Category:

Still looking for an answer?

Was this helpful?


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

I’m confused, are the steps under “On other systems, you can take the following steps:” on installing pip missing? Because after that it seems to point out that we need to install virtual_env, nothing about pip is mentioned.

I installed Django. I upload my django codes via ftp. Now i can see my codes but they didn’t work just see they as a file. How i can run this code on server?

@mtufekyapan: What do you mean? Do you have a webserver running?

hi, i installed django as per the instructions here. what further steps do i need to take in order to get my django code running from either my localhost or from my git repo (hosted on bitbucket)? can you provide me with the relevant steps to take. i have also installed git on my virtual server thanks in advance

@klimatima: Simply clone your git repo so you have the code on your droplet.

Actually I would install virtualenv in the canonical way:

sudo apt-get install python-pip
sudo apt-get install python-virtualenv
virtualenv example_env
source example_env/bin/activate
pip install Django

And just because on my system virtualenv.py from github fails!

@ernesto.troiano +1 for identifying problem and a working solution!

When I try this command frans@frans-eMachines-D620:~$ python virtualenv.py example_env

I get the error message python: can’t open file ‘virtualenv.py’: [Errno 2] No such file or directory

I also had to install curl

I am sorry the solution my be obvious, but I am stumped.

Problem solved Installed it the canonical way. Thanks

This comment has been deleted

Creative CommonsThis work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.