thank a lot everyone....it was really helpful...:) On Thu, May 13, 2010 at 7:33 PM, Karen Tracey <kmtra...@gmail.com> wrote:
> On Thu, May 13, 2010 at 2:53 AM, ravi krishna <ravi.9...@gmail.com> wrote: > >> Hi,,This is my url.py file, when i run this it shows indendation error at >> line 25. But i dont see an indendation error. Can somebody help me. I am >> just a beginner with Django. >> >> > It would help people help you if you were specific about the error. There > is more than one "indentation error" that Python might report, and the > specifics of the one you hit might be significant, especially since somehow > in posting the urls.py content it appears that all indentation has been > lost. However I think the problem is not actually due to indentation but > rather an incorrect close paren (see below). > > >> >> from django.conf.urls.defaults import * >> from django.conf import settings >> >> # Uncomment the next two lines to enable the admin: >> from django.contrib import admin >> admin.autodiscover() >> >> urlpatterns = patterns('', >> #if settings.DEBUG: >> # urlpatterns += patterns('django.views.static', >> # (r'^static_media/(?P<path>.*)$', >> # 'serve', { >> # 'document_root': '/path/to/static_media', >> # 'show_indexes': True }),) >> >> ) >> > > Note this close paren is terminating the patterns() call. Python won't be > expecting any code following this to be indented. > > >> # Example: >> # (r'^mysite/', include('mysite.foo.urls')), >> >> # Uncomment the admin/doc line below and add 'django.contrib.admindocs' >> # to INSTALLED_APPS 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')), >> > > I'm guessing this line is actually indented. Since the patterns calls has > been terminated, if this (the first non-commented line after the patterns > call termination) line is indented it will cause an unexpected indent error > in Python. Fix is to remove the close paren up above -- there is already a > close paren for the end of the patterns() call further down. If you want to > comment out the remaining lines in patterns it would be better to put a # in > the first column rather than insert an early close paren. > > > >> (r'^$','mysite.polls.views.index'), >> (r'^index','mysite.polls.views.index'), >> (r'^detail/(?P<poll_id>\d+)','mysite.polls.views.detail'), >> (r'^results/(?P<poll_id>\d+)','mysite.polls.views.results'), >> (r'^vote/(?P<poll_id>\d+)','mysite.polls.views.vote'), >> (r'^latest','mysite.polls.views.latest'), >> (r'^page1', 'polls.views.page1'), >> (r'^page2','polls.views.page2'), >> (r'^page3','polls.views.page3'), >> #(r'^site_media/(?P<path>.*)) >> #django.views.static.serve', {'document_root': '/path/to/media'}) >> (r'^site_media/(?P<path>.*), 'django.views.static.serve', >> {'document_root': '/root/Desktop/mysite/temp1/images'}) >> ) >> > > With the close paren up above, this last close paren does not match > anything, so it too will generate a syntax error if Python ever gets far > enough to see it. > > Karen > -- > http://tracey.org/kmt/ > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- Regards, Rav! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.