I am trying to set up an API using Django Rest, I've attempted to use the quick start guide, but all I can get is this error:
'Module_six_moves_urllib_parse' object has no attribute 'urlsplit'
I can't find any reference to this error on the internet, let alone how to solve it.
Here is my urls file:
from django.conf.urls import patterns, include, url
from django.contrib.auth.models import User
from django.contrib import admin
from rest_framework import routers, serializers, viewsets
admin.autodiscover()
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'email', 'is_staff')
class UserViewSet(viewsets.ModelViewSet):
queryset = User.objects.all()
serializer_class = UserSerializer
router = routers.DefaultRouter()
router.register(r'users', UserViewSet)
urlpatterns = patterns('',
url(r'^', include(router.urls)),
url(r'^', include('logs.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
)
Full traceback:
Environment:
Request Method: GET
Django Version: 1.6 Python Version: 2.7.6 Installed Applications: ('rest_framework', 'south', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'logs', 'django_nose') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware')
Template error: In template /Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/rest_framework/templates/rest_framework/base.html, error at line 87 'Module_six_moves_urllib_parse' object has no attribute 'urlsplit' 77 :
rel="nofollow" title="Make a GET request on the {{ name }} resource">GET78 :
79 :
80 : title="Specify a format for the GET request">
81 :
82 :
83 :
84 : {% for format in available_formats %}
85 :
86 :
87 : href=' {% add_query_param request api_settings.URL_FORMAT_OVERRIDE format %} '
88 :
rel="nofollow"89 : title="Make a GET request on the {{ name }} resource with the format set to
{{ format }}
">90 : {{ format }}
91 :
92 :
93 : {% endfor %}
94 :
95 :
96 :
97 :
Traceback: File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 139. response = response.render() File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/response.py" in render 105. self.content = self.rendered_content File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/rest_framework/response.py" in rendered_content 59. ret = renderer.render(self.data, media_type, context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/rest_framework/renderers.py" in render 733. ret = template.render(context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/base.py" in render 140. return self._render(context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/base.py" in _render 134. return self.nodelist.render(context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/base.py" in render 840. bit = self.render_node(node, context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/debug.py" in render_node 78. return node.render(context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/loader_tags.py" in render 123. return compiled_parent._render(context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/base.py" in _render 134. return self.nodelist.render(context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/base.py" in render 840. bit = self.render_node(node, context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/debug.py" in render_node 78. return node.render(context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/loader_tags.py" in render 62. result = block.nodelist.render(context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/base.py" in render 840. bit = self.render_node(node, context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/debug.py" in render_node 78. return node.render(context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/defaulttags.py" in render 305. return nodelist.render(context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/base.py" in render 840. bit = self.render_node(node, context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/debug.py" in render_node 78. return node.render(context) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/defaulttags.py" in render 196. nodelist.append(node.render(context)) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/django/template/base.py" in render 1125. return func(*resolved_args, **resolved_kwargs) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/rest_framework/templatetags/rest_framework.py" in add_query_param 86. return escape(replace_query_param(uri, key, val)) File "/Users/taylorhobbs/.virtualenvs/Workout_log/lib/python2.7/site-packages/rest_framework/templatetags/rest_framework.py" in replace_query_param 22. (scheme, netloc, path, query, fragment) = urlparse.urlsplit(url)
Exception Type: AttributeError at / Exception Value: 'Module_six_moves_urllib_parse' object has no attribute 'urlsplit'