>> url(r'^$, views.index, name='index'), Are you sure if you have closing single quote with *r'^$* ? I do not see it in error.
On 2 February 2016 at 17:00, Russell Stanfield <[email protected]> wrote: > Hi, > > at this page: > > https://docs.djangoproject.com/en/1.9/intro/tutorial01/ > > I have got this far in the tutorial: > > > In the polls/urls.py file include the following code: > polls/urls.py > > from django.conf.urls import url > from . import views > urlpatterns = [ > url(r'^$', views.index, name='index'),] > > The next step is to point the root URLconf at the polls.urls module. In > mysite/urls.py, add an import for django.conf.urls.include and insert an > include() > <https://docs.djangoproject.com/en/1.9/ref/urls/#django.conf.urls.include> > in the urlpatterns list, so you have: > mysite/urls.py > > from django.conf.urls import include, urlfrom django.contrib import admin > urlpatterns = [ > url(r'^polls/', include('polls.urls')), > url(r'^admin/', admin.site.urls), > > > You have now wired an index view into the URLconf. Lets verify it’s > working, run the following command: > > $ python manage.py runserver > > When I try to start the server I get the following output: > > > root@russellberrypi:/home/mycode/mysite# python manage.py > <https://urldefense.proofpoint.com/v2/url?u=http-3A__manage.py&d=CwQFAw&c=gtIjdLs6LnStUpy9cTOW9w&r=EAFJA60ozpEG7CKx_ndsiec5Gk2t6AonM-XdcrNQz58&m=pMDrmX6Sr2GcBXNtecTdHV8sGB7GrhnrNNeDF7lqU_c&s=buQ8GHo2LGLM-xpbF5UaqjVTwMAnP9_3iWD3zh2m374&e=> > runserver > Performing system checks... > > Unhandled exception in thread started by <function wrapper at 0x20aaaf0> > Traceback (most recent call last): > File > "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line > 226, in wrapper > fn(*args, **kwargs) > File > "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", > line 116, in inner_run > self.check(display_num_errors=True) > File > "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", > line 426, in check > include_deployment_checks=include_deployment_checks, > File > "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py", > line 75, in run_checks > new_errors = check(app_configs=app_configs) > File > "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line > 10, in check_url_config > return check_resolver(resolver) > File > "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line > 19, in check_resolver > for pattern in resolver.url_patterns: > File > "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line > 33, in __get__ > res = instance.__dict__[self.name > <https://urldefense.proofpoint.com/v2/url?u=http-3A__self.name&d=CwQFAw&c=gtIjdLs6LnStUpy9cTOW9w&r=EAFJA60ozpEG7CKx_ndsiec5Gk2t6AonM-XdcrNQz58&m=pMDrmX6Sr2GcBXNtecTdHV8sGB7GrhnrNNeDF7lqU_c&s=HSx40eR6s58492yx-HMhf5467dHu8YOhUO7tQFhcMc4&e=>] > = self.func(instance) > File > "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line > 417, in url_patterns > patterns = getattr(self.urlconf_module, "urlpatterns", > self.urlconf_module) > File > "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line > 33, in __get__ > res = instance.__dict__[self.name > <https://urldefense.proofpoint.com/v2/url?u=http-3A__self.name&d=CwQFAw&c=gtIjdLs6LnStUpy9cTOW9w&r=EAFJA60ozpEG7CKx_ndsiec5Gk2t6AonM-XdcrNQz58&m=pMDrmX6Sr2GcBXNtecTdHV8sGB7GrhnrNNeDF7lqU_c&s=HSx40eR6s58492yx-HMhf5467dHu8YOhUO7tQFhcMc4&e=>] > = self.func(instance) > File > "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line > 410, in urlconf_module > return import_module(self.urlconf_name) > File "/usr/lib/python2.7/importlib/__init__.py", line 37, in > import_module > __import__(name) > File "/home/mycode/mysite/mysite/urls.py", line 20, in <module> > url(r'^polls/', include('polls.urls')), > File > "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line > 52, in include > urlconf_module = import_module(urlconf_module) > File "/usr/lib/python2.7/importlib/__init__.py", line 37, in > import_module > __import__(name) > File "/home/mycode/mysite/polls/urls.py", line 8 > url(r'^$, views.index, name='index'), > ^ > SyntaxError: invalid syntax > > > > I think all the files I have created/edited look good, but can put them > up here if required.... > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/643917c9-17f7-4e0c-aed0-df8ab1e9f831%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/643917c9-17f7-4e0c-aed0-df8ab1e9f831%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHHn46TrWi6v4o2-8LwQj6PgwMwVpftAzx3QkoLZoxGhtcdTAw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

