Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8945629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:17:26+00:00 2026-06-15T12:17:26+00:00

Basically working with django and it keeps telling me that there’s a syntax error

  • 0

Basically working with django and it keeps telling me that there’s a syntax error in this code:

from django.conf.urls import patterns, url

from venues import views

urlpatterns = patterns('',
    url(r'^$', views.index, name = 'index'),

    # ex /venues/3
    url(r'^(?P<venue_id>\d+)/$', views.detail, name='detail'),
    # ex: /venues/3/events
    url(r'^(?P<venue_id>\d+)/events/$', views.events, name='events')
)

Specifically it seems to be telling me that the:

from venues import views

line is incorrect.

However my venues/views.py looks like:

from django.http import HttpResponse

def index(request):
    return HttpResponse("Hello this is the home page!")

def detail(request, venue_id):
    return HttpResponse("You're looking at Venue %s.", % venue_id)

def events(request, venue_id):
    return HttpResponse("You're looking at events at venue %s.", % venue_id)

So the file exists and seems to be doing just fine until I start using venue_id in the urls.py

Oh and just for good measure my main urls.py looks like:

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

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

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'Comedy.views.home', name='home'),
    # url(r'^Comedy/', include('Comedy.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
    url(r'^venues/', include('venues.urls')),
)

So I’m not entirely sure where the issue is coming from, all help appreciated.

Many Thanks,
Me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:17:27+00:00Added an answer on June 15, 2026 at 12:17 pm

    Your view.py file does have syntax errors:

    return HttpResponse("You're looking at Venue %s.", % venue_id)
    

    and

    return HttpResponse("You're looking at events at venue %s.", % venue_id)
    

    have commas between the string and the % string formatting operator, and that is not legal python syntax. Remove the commas before the % operators.

    Please, in future, always include the full python traceback when reporting a problem with your Python code, that saves us from having to guess what your problem is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So basically this code was working fine before. I had some computer issues and
I am working on some code, basically I have a form. On that form
Im basically working on an image analyser that downloads images from another server. I
I am working on creating a simple contest submission system using django. This is
I've gotten this json object back from django. I was wondering how do we
I'm working on a website that keeps track of upcoming homework assignments. I'd like
I got my Apache Mod_WSGI and Django working following http://blog.stannard.net.au/2010/12/11/installing-django-with-apache-and-mod_wsgi-on-ubuntu-10-04/ with a twist that
I am working on a django project that provides an API to generate thumbnails
I've been working on a web app using Django, and I'm curious if there
Basically I'm working on a website for a USB Drive manufacturer. I've used a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.