How do I install Tastypie for Django?
-
22-06-2021 - |
Domanda
I am following the instructions to install Tastypie for Django and I am stuck somewhere between step 2 and 3. I successfully ran "sudo pip install django-tastypie" however, I don't know where the "tastypie" directory is that I am supposed to use for the symlink.
Soluzione
It would depend on your distro and version of Python. Most likely the folder you are looking for is located in the site-packages
subfolder under your python home folder.
To see the exact location try running:
python -m site
For more details also try:
python -m site --help
And you can get only the sys.path
by running:
python -c "import sys; print ('\n').join(sys.path)"
Altri suggerimenti
Tastypie has already been added to your pythonpath. To check, type python in your command line and then type import tastypie. if you do not see an error, you're good.
Just add tastypie to your installed apps and use it with django.
Install tastypie via pip:
sudo pip install django-tastypie &&
sudo pip install djangorestframework
Add it to your installed apps:
INSTALLED_APPS = (
'tastypie',
'rest_framework',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
)
You can run easy_install django-tastypie
, if using virtualenv
.