简体   繁体   中英

Syntax Error in Django urls.py

I'm having a frustrating time installing a very simple recipes website for myself using Django. Everything has been going fine until I attempt to set up my urls.py, which reads:

from django.conf.urls.defaults import *
from django.contrib import admin
from timsrecipes.recipes import views
admin.autodiscover()


urlpatterns = patterns('',
      (r'^index/$', views.index),
      (r'^search/$',views.search),
      (r'^ingredientsearch/$', views.ingredientsearch),
      (r'^admin/', include(admin.site.urls)),
)

The database containing the recipes has been set up, validated, and synchronized, but when I attempt to access any of the webpages, I get the following error message:

Exception Value: ('invalid syntax', ('/Users/mary/Programming-Startup/timsrecipes/../timsrecipes/recipes/views.py', 13, 10, ' )\\n'))

Exception Location: /Users/mary/Programming-Startup/timsrecipes/../timsrecipes/urls.py in , line 3

I really cannot see what the syntax error is here. Several other small websites I've built have this same formula for importing their views, so I cannot understand what the problem could be.

例外不在urls.py中,而是在recipes / views.py中的第13行中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM