2

I am a beginner in django and did the basic tutorials on the official website.

I want to learn the django rest framework, and I saw that there is also a great tutorials here - http://www.django-rest-framework.org/#requirements.

One thing I couldn't figure out - How do I install the framework and the other necessary things for it? I am working offline so I need to download all the libraries/packages manually and than install them. (cant use pip install and github clone)

An explanation for what do I need to download and how to install it in order to use the django rest framework would be highly appreciated :)

thanks in advance

rnevius
  • 26,578
  • 10
  • 58
  • 86
Ofek Agmon
  • 5,040
  • 14
  • 57
  • 101
  • I don't understand...if you can download a package for offline use, you can use `pip` to install for offline use... – rnevius Mar 30 '15 at 06:40
  • hanks for you answer. the computer i am downloading from is not the one I am working on. so I want to know what do I nned to download and takes to the other computer.. saw this page - https://pypi.python.org/pypi/djangorestframework/3.1.1#downloads, is this what I need? and there are also two files, not sure which one – Ofek Agmon Mar 30 '15 at 06:49
  • Possible duplicate: http://stackoverflow.com/questions/15031694/installing-python-packages-from-local-file-system-folder-with-pip – rnevius Mar 30 '15 at 07:02

1 Answers1

7

I think you're a little confused about how pip works. Installing an application with pip will allow you to use it offline.

As per the official repo:

$ pip install djangorestframework

And then add 'rest_framework' to your INSTALLED_APPS setting:

INSTALLED_APPS = (
    ...
    'rest_framework',
)

You can now use DRF offline.

EDIT: If the machine you're developing on doesn't have the ability to connect to the internet, you can clone the github repo, copy it to your offline machine, and then run:

pip install -e /srv/pkg

...where /srv/pkg is the top-level directory where setup.py exists.

rnevius
  • 26,578
  • 10
  • 58
  • 86
  • okay thanks. just want to make sure, the /srv/pkg is the directory of the rest-framrwork zip (uncomprassed off course) in my off-line machine right? where the setup.py? and also, I guess the pip install -e means that its local on the computer? thanks a lot – Ofek Agmon Mar 30 '15 at 06:54
  • and one more question - is the rest-framework from github is all I need to install in order to use it? are there any other necessary things to do? – Ofek Agmon Mar 30 '15 at 06:58
  • **setup.py** will be in the uncompressed folder of the app. You need to replace `srv/pkg` with the absolute path to the **setup.py** file in the package. – rnevius Mar 30 '15 at 07:00
  • okay.. meaning somethong like dir/setup.py right? or to the folder that contains setup.py – Ofek Agmon Mar 30 '15 at 07:02