1

What's causing the syntax error in this urls.py ?

It says

syntax error at Line 27[(r'^xd_receiver\.html$',.....] in ursl.py.

I can't figure out where the problem is.

  urlpatterns = patterns('',
        # Example:
        # (r'^universityDB/', include('universityDB.foo.urls')),

        # Uncomment the admin/doc line below to enable admin documentation:
        # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
        # Uncomment the next line to enable the admin:
        (r'^admin/', include(admin.site.urls)),
        (r'^registrationForm/$','universityDB.universityDetails.views.registrationForm'),
        (r'^userDetails/$','universityDB.universityDetails.views.userDetails'),
        (r'^login/$','universityDB.universityDetails.views.login'),
        (r'^userCreated/$','universityDB.universityDetails.views.userCreated'),
        (r'^forgotPassword/$','universityDB.universityDetails.views.forgotPassword'),
        (r'^passwordRecovery/$','universityDB.universityDetails.views.passwordRecovery'),     
        (r'^accounts/profile', 'universityDB.universityDetails.views.profile'),   
        (r'^xd_receiver\.html$', direct_to_template, {'template': 'xd_receiver.html'}, name='xd_receiver'),   
        (r'^login_facebook_connect/$', 'login_facebook_connect', name='facebook_connect_ajax'),

    )

1 Answer 1

5

If you want to name your URLs, you must use the url(...) function, i.e.

url(r'^xd_receiver\.html$', direct_to_template, {'template': 'xd_receiver.html'}, name='xd_receiver')

…rather than:

(r'^xd_receiver\.html$', direct_to_template, {'template': 'xd_receiver.html'}, name='xd_receiver')
Sign up to request clarification or add additional context in comments.

1 Comment

one clarification there is no force or must to use url(). you can simply write (r'^xd_receiver\.html$', direct_to_template, {'template': 'xd_receiver.html'}, 'xd_receiver') which will work fine (using tuples)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.