Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django - invalid syntax (urls.py, line 7)

Tags:

django

I'm doing a slight variation on my urls.py from the tutorial where I have the following -

mysite/urls.py -

from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^TidalDEV/', include('TidalDEV.urls')),
)

TidalDEV/urls.py -

from django.conf.urls import patterns, url

from TidalDEV import views

urlpatterns = patterns('',
    url(r'^$', views.index, name='index')
    url(r'^(?P<pk>[0-9]+)/$', views.tesxml, name='tesxml'),
)

And this is the view in views.py -

def tesxml(self, request, pk, format=None, renderer_context=None):
    """
    returns an XML of a jobmst listing
    """
    template_vars['jobmst'] = (queryset1, [pk])
    template_vars['jobdtl'] = (queryset2, [pk]) 
    template_vars['jobdep'] = (queryset3, [pk])

    t = loader.get_template('TidalAPI/templates/xml_template.xml')
    c = Context(template_vars)

    return HttpResponse(t.render(c), mimetype="text/xml")

When I try to hit my url at http://localhost:8080/TidalDEV/10081/ I get invalid syntax. What is the problem here?

Essentially I need the view to populate a template XML file I built.

like image 637
whoisearth Avatar asked Jan 25 '14 00:01

whoisearth


1 Answers

You are missing a comma after your index view in TidalDEV/urls.py

like image 192
Peter DeGlopper Avatar answered Sep 25 '22 10:09

Peter DeGlopper