Mike
Mike

Reputation: 188

Django Invalid Syntax Error

I am at my wits. I am trying to set up Django admin but I am having a hard time. I have followed the Django book and checked several times but get an invalid syntax (urls.py, line 23).

from django.conf.urls.defaults import *
from mysite.views import hello, current_datetime, hours_ahead

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    (r'^hello/$', hello),
    (r'^time/$', current_datetime),
    (r'^time/plus/(\d{1,2})/$', hours_ahead),
    (r'^admin/', include(admin.site.urls), 
)

Any insight would be appreciated - thanks!

Upvotes: 1

Views: 3826

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1124248

You are missing a closing parens on line 22:

(r'^admin/', include(admin.site.urls)), 

When you get a SyntaxError in Python, check that your parenthesis are balanced on the lines preceding it.

Upvotes: 4

Related Questions