checking of correct installation and configuration of tastypie

Skip to first unread message

Tastypie

unread,
May 22, 2012, 1:42:25 AM5/22/12
to Tastypie
hi,
i started learning Tsatypie so i follow the example in the
documentation but i got an error :
name 'EntryResource' is not defined
i just want to know if my installation is correct !!
is there any command to check the installation and configuration of
Tastypie ???
there is the example which i followed : 'the official documentation'
http://django-tastypie.readthedocs.org/en/latest/tutorial.html#configuration

thanks for any help

johnoc

unread,
May 22, 2012, 3:57:38 AM5/22/12
to django-...@googlegroups.com

have you imported the EntryResource ?
take a look in urls.py and make sure something like this is there:

from myapp.api import EntryResource

where myapp is the name of you app.

hope that helps!

Belhouchet Ines

unread,
May 22, 2012, 4:45:36 AM5/22/12
to django-...@googlegroups.com
thanks a lot :))

i fixed by changing myapp to the name of my application but i still have error
when i try to run server by this commend: python manage.py runserver
i got this error in the terminal:

python manage.py runserver
Validating models...

Unhandled exception in thread started by <bound method
Command.inner_run of
<django.contrib.staticfiles.management.commands.runserver.Command
object at 0x9b6a96c>>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py",
line 91, in inner_run
self.validate(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
line 266, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py",
line 30, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py",
line 158, in get_app_errors
self._populate()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py",
line 67, in _populate
self.load_app(app_name)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py",
line 88, in load_app
models = import_module('.models', app_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py",
line 35, in import_module
__import__(name)
File "/home/inesso/tstp_pr/firstpr/hiworld/models.py", line 1, in <module>
from tastypie.utils.timezone import now
ImportError: No module named timezone


and this my file : models.py

from tastypie.utils.timezone import now
from django.contrib.auth.models import User
from django.db import models
from django.template.defaultfilters import slugify


class Entry(models.Model):
user = models.ForeignKey(User)
pub_date = models.DateTimeField(default=now)
title = models.CharField(max_length=200)
slug = models.SlugField()
body = models.TextField()

def __unicode__(self):
return self.title

def save(self, *args, **kwargs):
# For automatic slug generation.
if not self.slug:
self.slug = slugify(self.title)[:50]
return super(Entry, self).save(*args, **kwargs)

please help me !!





2012/5/22, johnoc <joh...@gmail.com>:

Belhouchet Ines

unread,
May 22, 2012, 4:49:24 AM5/22/12
to django-...@googlegroups.com
By the way i think that the error is about the timezone module !!
how can i check the installation of this module ??

2012/5/22, Belhouchet Ines <belhouc...@gmail.com>:

johnoc

unread,
May 22, 2012, 4:58:01 AM5/22/12
to django-...@googlegroups.com


yes its complaining about not having the tastypie timezone module.

go to your tastypie installation and then look under
<your tastypie installation>/lib/python2.7/site-packages/tastypie/utils

there should be a timezone.py in there.

if its not then you have an installation problem.

if it is there then you have a PYTHONPATH problem.

make sure your python path has an entry for tastypie:
ie. <your tastypie installation>/lib/python2.7/site-packages/tastypie/

hope that helps!

Belhouchet Ines

unread,
May 22, 2012, 5:19:16 AM5/22/12
to django-...@googlegroups.com
i checked under /usr/loca/lib/python.2.7/ and i didn't found any files
in site-packages directory.
but in dist-packages i found many folders and files about Django and
tastypie but still i don't found in
/usr/local/lib/python2.7/dist-packages/tastypie/utils the timezone.py
file!!!

should i download from "python-dateutil":
http://labix.org/python-dateutil the package adequat and extract it
in the utils directory or is there an other solution ????

2012/5/22, johnoc <joh...@gmail.com>:

johnoc

unread,
May 22, 2012, 5:30:04 AM5/22/12
to django-...@googlegroups.com

follow the installation instructions to the letter. that means yes you must install the dateutil.

then from the shell command line try the following:

> ./manage.py shell
>>> from tastypie.utils.timezone import now
>>>

if that comes back with no error then you are laughing.
otherwise i suspect your PYTHONPATH is borked.

Bruno Rocha

unread,
May 23, 2012, 10:28:37 AM5/23/12
to django-...@googlegroups.com
I am having the same problem with Django 1.4, I installed dateutil before the instalation of tastypie, but the timezone still not gets installed.

Should I pull the bitbucket repository int he place of tastypie in dist-packages?
--

Belhouchet Ines

unread,
May 23, 2012, 6:34:46 PM5/23/12
to django-...@googlegroups.com
hi,
me too (: i still having the same problem is it rely to OS problem??
i have ubuntu 12.04 .
should i try it on an other machine ??


2012/5/23, Bruno Rocha <rocha...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages