Ebrahim Mehrvarz
Ebrahim Mehrvarz

Reputation: 1

API in Django with Tastypie

I have created an API in latest version of Django using latest version of Tastypie. When I run the server of Django I get this error:

cant import "datetime_safe" from "django.utils"

I already have tried reinstalling the tastypie.

Upvotes: 0

Views: 209

Answers (2)

alexei rysev
alexei rysev

Reputation: 73

Try to install latest version of django-tastyepie from git repository

pip install git+https://github.com/django-tastypie/django-tastypie.git

Upvotes: 0

WebCoder49
WebCoder49

Reputation: 31

The datetime_safe module Tastypie is trying to access does not exist from version 5.0 of Django onwards. This is because Tastypie requires Django version 4.2 and does not support Django 5.* which you seem to have installed.

You need to run this in the command line to downgrade Django to v4.2. (source: this SO post)

python -m pip install --upgrade Django==4.2.8

I hope this is helpful - please let me know if it doesn't work.

Upvotes: 0

Related Questions