Oops... You are right . Thanks for your remind On Mon, Mar 13, 2017 at 2:20 PM Xavier Ordoquy <[email protected]> wrote:
> Hi madame, > > You have missed the trailing dot in this part in the tutorial: > > django-admin.py startproject tutorial . # Note the trailing '.' character > > > Regards, > Xavier Ordoquy, > Linovia. > > > Le 13 mars 2017 à 07:06, Tony Wang <[email protected]> a écrit : > > Hi Guys > > Have you guys tested the code in quickstart? There seems be to an import > error . It will run well when removed tutorial (Marked italic and red). > > > Environment: > > > Request Method: GET > Request URL: http://10.211.55.12:8000/users/1/ > > Django Version: 1.8.13 > Python Version: 2.7.12 > Installed Applications: > ('django.contrib.admin', > 'django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.messages', > 'django.contrib.staticfiles', > 'rest_framework', > 'restapp') > Installed Middleware: > ('django.contrib.sessions.middleware.SessionMiddleware', > 'django.middleware.common.CommonMiddleware', > 'django.middleware.csrf.CsrfViewMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', > 'django.contrib.messages.middleware.MessageMiddleware', > 'django.middleware.clickjacking.XFrameOptionsMiddleware', > 'django.middleware.security.SecurityMiddleware') > > > Traceback: > File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" > in get_response > 119. resolver_match = resolver.resolve(request.path_info) > File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" > in resolve > 365. for pattern in self.url_patterns: > File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" > in url_patterns > 401. patterns = getattr(self.urlconf_module, "urlpatterns", > self.urlconf_module) > File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" > in urlconf_module > 395. self._urlconf_module = import_module(self.urlconf_name) > File "/usr/lib/python2.7/importlib/__init__.py" in import_module > 37. __import__(name) > File "/root/rest_example/rest_example/urls.py" in <module> > 18. from restapp import views > File "/root/rest_example/restapp/views.py" in <module> > 3. from tutorial.quickstart.serializers import UserSerializer, > GroupSerializer > > Exception Type: ImportError at /users/1/ > Exception Value: No module named tutorial.quickstart.serializers > > > > > http://www.django-rest-framework.org/tutorial/quickstart/ > > from django.contrib.auth.models import User, Groupfrom rest_framework import > viewsetsfrom *tutorial**.*quickstart.serializers import UserSerializer, > GroupSerializer > > class UserViewSet(viewsets.ModelViewSet): > """ > API endpoint that allows users to be viewed or edited. > """ > queryset = User.objects.all().order_by('-date_joined') > serializer_class = UserSerializer > > class GroupViewSet(viewsets.ModelViewSet): > """ > API endpoint that allows groups to be viewed or edited. > """ > queryset = Group.objects.all() > serializer_class = GroupSerializer > > > -- > You received this message because you are subscribed to the Google Groups > "Django REST framework" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to the Google Groups > "Django REST framework" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Tony Wang Warm Regards -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
