S_alj
S_alj

Reputation: 447

Google App Engine import error, for django.urls

I'm trying to learn Django, so I completed their multi-part tutorial (Python 2.7) and ran it locally. I got it working fine on my PC.

I need the following import, in a views.py file:

from django.urls import reverse

When I upload it to GAE, it gives me the following error: Exception Type: ImportError Exception Value: No module named urls

Is this module unavailable for the GAE, or am I doing something wrong? (By the way, I need this import so I can use the "reverse" method, after a user submission is received in the polls app, like: HttpResponseRedirect(reverse('polls:results', args=(question.id,))) )

Upvotes: 0

Views: 113

Answers (1)

knbk
knbk

Reputation: 53699

reverse() was moved from django.core.urlresolvers to django.urls in Django 1.10. The error suggests that you are using an older version of Django.

You need to import reverse() from the old location:

from django.core.urlresolvers import reverse

Upvotes: 1

Related Questions