5👍
✅
Make sure you added tastypie
to INSTALLED_APPS
and launched manage.py syncdb
to create tastypie tables into the database (there are 2: tastypie_apiaccess
& tastypie_apikey
).
6👍
OK, I had a similar issue, but it wasn’t solved by the solution given by @manji.
The problem has to do with Django and the use of the create_api_key
signal. syncdb
will create the user first before tastypie is able to create its tables.
The solution that worked for me was:
-
Wrap your signal in your model with a
try/except
statement like:try: models.signals.post_save.connect(create_api_key, sender=User) except Exception, e: pass
-
Run
./manage.py syncdb --migrate
- Run
./manage.py backfill_api_keys
Here’s the issue on GitHub for your reference: https://github.com/toastdriven/django-tastypie/issues/195
- [Django]-How to save ManyToMany field in second database
- [Django]-Showing auth_message's
- [Django]-"Last" tag not working
- [Django]-Django REST framework nested serializer and POST nested JSON with files
Source:stackexchange.com