Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 4, 2011 15:22:20

h.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Syntax Error


Can someone explain to me what the following error is trying to tell
me:

SyntaxError at /polls/1
invalid syntax (urls.py, line 20)Request Method: GET
Request URL:http://127.0.0.1:8000/polls/1Django Version: 1.2.3
Exception Type: SyntaxError
Exception Value: invalid syntax (urls.py, line 20)
Exception Location: C:\Python27\lib\site-packages\django\utils
\importlib.py in import_module, line 35
Python Executable: C:\Python27\python.exe
Python Version: 2.7.1
Python Path:
Server time: Tue, 4 Jan 2011 09:12:32 -0600

The urls.py module that it is referring to looks like this:

from django.conf.urls.defaults import *

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

#urlpatterns = patterns('',
# Example:
# (r'^mysite/', include('mysite.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'^polls/$',
'polls.views.index'),
# (r'^polls/(?P<poll_id>\d+)/$', 'polls.views.detail'),
# (r'^polls/(?P<poll_id>\d+)/results/$', 'polls.views.results'),
# (r'^polls/(?P<poll_id>\d+)/vote/$', 'polls.views.vote'),
# (r'^admin/', include(admin.site.urls)),
#)

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


and I thought it had previously worked ok when I last tried to use it
back on the 23rd. I would appreciate any help or direction in
debugging this since I'm relatively new to both django and python.
Thanks.


--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 4, 2011 15:40:30

Piotr Z.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Syntax Error


what happens if you'remove the commented lines?

On 01/04/11 15:22, hank23 wrote:
> Can someone explain to me what the following error is trying to tell
> me:
>
> SyntaxError at /polls/1
> invalid syntax (urls.py, line 20)Request Method: GET
> Request URL:http://127.0.0.1:8000/polls/1> Django Version: 1.2.3
> Exception Type: SyntaxError
> Exception Value: invalid syntax (urls.py, line 20)
> Exception Location: C:\Python27\lib\site-packages\django\utils
> \importlib.py in import_module, line 35
> Python Executable: C:\Python27\python.exe
> Python Version: 2.7.1
> Python Path:
> Server time: Tue, 4 Jan 2011 09:12:32 -0600
>
> The urls.py module that it is referring to looks like this:
>
> from django.conf.urls.defaults import *
>
> # Uncomment the next two lines to enable the admin:
> from django.contrib import admin
> admin.autodiscover()
>
> #urlpatterns = patterns('',
> # Example:
> # (r'^mysite/', include('mysite.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'^polls/$',
> 'polls.views.index'),
> # (r'^polls/(?P<poll_id>\d+)/$', 'polls.views.detail'),
> # (r'^polls/(?P<poll_id>\d+)/results/$', 'polls.views.results'),
> # (r'^polls/(?P<poll_id>\d+)/vote/$', 'polls.views.vote'),
> # (r'^admin/', include(admin.site.urls)),
> #)
>
> urlpatterns = patterns('',
> (r'^polls/', include('polls.urls')),
> (r'^admin/', include(admin.site.urls)),
> )
>
>
> and I thought it had previously worked ok when I last tried to use it
> back on the 23rd. I would appreciate any help or direction in
> debugging this since I'm relatively new to both django and python.
> Thanks.
>
>


--
bloghttp://piotr.zalewa.infojobshttp://webdev.zalewa.infotwithttp://twitter.com/zalunfacehttp://facebook.com/zaloon--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Jan. 4, 2011 16:08:28

h.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Syntax Error


After removing the commented code, saving urls.py, restarting the
server and then requesting the sites admin page now I get the admin
login screen. But after I type in my username and pw then it again
gives me the following screen:

TemplateSyntaxError at /admin/
Caught SyntaxError while rendering: invalid syntax (urls.py, line
20)Request Method: GET
Request URL:http://127.0.0.1:8000/admin/Django Version: 1.2.3
Exception Type: TemplateSyntaxError
Exception Value: Caught SyntaxError while rendering: invalid syntax
(urls.py, line 20)
Exception Location: C:\Python27\lib\site-packages\django\utils
\importlib.py in import_module, line 35
Python Executable: C:\Python27\python.exe
Python Version: 2.7.1
Python Path:
Server time: Tue, 4 Jan 2011 09:45:54 -0600

and still references the same line in urls.py, which is confusing
because now it shouldn't have a line 20. Here's what urls.py currently
looks like:

from django.conf.urls.defaults import *

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

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


Could this problem be related to windows 7 environment variables not
being set properly? I ask because I was upgraded recently from Win XP
to Windows 7 and have been working to set up my environment variables
back to where they should be. I thought I had previously fixed all of
them, but maybe I missed something. Please advise. Thanks.



On Jan 4, 9:36 am, Piotr Zalewa <zal...@gmail.com> wrote:
> what happens if you'remove the commented lines?
>
> On 01/04/11 15:22, hank23 wrote:
>
>
>
>
>
> > Can someone explain to me what the following error is trying to tell
> > me:
>
> > SyntaxError at /polls/1
> > invalid syntax (urls.py, line 20)Request Method: GET
> > Request URL:http://127.0.0.1:8000/polls/1> > Django Version: 1.2.3
> > Exception Type: SyntaxError
> > Exception Value: invalid syntax (urls.py, line 20)
> > Exception Location: C:\Python27\lib\site-packages\django\utils
> > \importlib.py in import_module, line 35
> > Python Executable: C:\Python27\python.exe
> > Python Version: 2.7.1
> > Python Path:
> > Server time: Tue, 4 Jan 2011 09:12:32 -0600
>
> > The urls.py module that it is referring to looks like this:
>
> > from django.conf.urls.defaults import *
>
> > # Uncomment the next two lines to enable the admin:
> > from django.contrib import admin
> > admin.autodiscover()
>
> > #urlpatterns = patterns('',
> >     # Example:
> >     # (r'^mysite/', include('mysite.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'^polls/$',
> > 'polls.views.index'),
> > #    (r'^polls/(?P<poll_id>\d+)/$', 'polls.views.detail'),
> > #    (r'^polls/(?P<poll_id>\d+)/results/$', 'polls.views.results'),
> > #    (r'^polls/(?P<poll_id>\d+)/vote/$', 'polls.views.vote'),
> > #    (r'^admin/', include(admin.site.urls)),
> > #)
>
> > urlpatterns = patterns('',
> >     (r'^polls/', include('polls.urls')),
> >     (r'^admin/', include(admin.site.urls)),
> > )
>
> > and I thought it had previously worked ok when I last tried to use it
> > back on the 23rd. I would appreciate any help or direction in
> > debugging this since I'm relatively new to both django and python.
> > Thanks.
>
> --
> bloghttp://piotr.zalewa.info> jobshttp://webdev.zalewa.info> twithttp://twitter.com/zalun> facehttp://facebook.com/zaloon-Hide quoted text -
>
> - Show quoted text -

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Jan. 4, 2011 17:54:25

c.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Syntax Error


Is it possible that the problem is not in this urls.py, but rather in
'polls.urls'?

I'd check line 20 there, just to see if there's an obvious python
syntax error.

HTH

c

On Jan 4, 8:08 am, hank23 <hversem...@stchas.edu> wrote:
> After removing the commented code, saving urls.py, restarting the
> server and then requesting the sites admin page now I get the admin
> login screen. But after I type in my username and pw then it again
> gives me the following screen:
>
> TemplateSyntaxError at /admin/
> Caught SyntaxError while rendering: invalid syntax (urls.py, line
> 20)Request Method: GET
> Request URL:http://127.0.0.1:8000/admin/> Django Version: 1.2.3
> Exception Type: TemplateSyntaxError
> Exception Value: Caught SyntaxError while rendering: invalid syntax
> (urls.py, line 20)
> Exception Location: C:\Python27\lib\site-packages\django\utils
> \importlib.py in import_module, line 35
> Python Executable: C:\Python27\python.exe
> Python Version: 2.7.1
> Python Path:
> Server time: Tue, 4 Jan 2011 09:45:54 -0600
>
> and still references the same line in urls.py, which is confusing
> because now it shouldn't have a line 20. Here's what urls.py currently
> looks like:
>
> from django.conf.urls.defaults import *
>
> # Uncomment the next two lines to enable the admin:
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>     (r'^polls/', include('polls.urls')),
>     (r'^admin/', include(admin.site.urls)),
> )
>
> Could this problem be related to windows 7 environment variables not
> being set properly? I ask because I was upgraded recently from Win XP
> to Windows 7 and have been working to set up my environment variables
> back to where they should be. I thought I had previously fixed all of
> them, but maybe I missed something. Please advise. Thanks.
>
> On Jan 4, 9:36 am, Piotr Zalewa <zal...@gmail.com> wrote:
>
>
>
> > what happens if you'remove the commented lines?
>
> > On 01/04/11 15:22, hank23 wrote:
>
> > > Can someone explain to me what the following error is trying to tell
> > > me:
>
> > > SyntaxError at /polls/1
> > > invalid syntax (urls.py, line 20)Request Method: GET
> > > Request URL:http://127.0.0.1:8000/polls/1> > > Django Version: 1.2.3
> > > Exception Type: SyntaxError
> > > Exception Value: invalid syntax (urls.py, line 20)
> > > Exception Location: C:\Python27\lib\site-packages\django\utils
> > > \importlib.py in import_module, line 35
> > > Python Executable: C:\Python27\python.exe
> > > Python Version: 2.7.1
> > > Python Path:
> > > Server time: Tue, 4 Jan 2011 09:12:32 -0600
>
> > > The urls.py module that it is referring to looks like this:
>
> > > from django.conf.urls.defaults import *
>
> > > # Uncomment the next two lines to enable the admin:
> > > from django.contrib import admin
> > > admin.autodiscover()
>
> > > #urlpatterns = patterns('',
> > >     # Example:
> > >     # (r'^mysite/', include('mysite.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'^polls/$',
> > > 'polls.views.index'),
> > > #    (r'^polls/(?P<poll_id>\d+)/$', 'polls.views.detail'),
> > > #    (r'^polls/(?P<poll_id>\d+)/results/$', 'polls.views.results'),
> > > #    (r'^polls/(?P<poll_id>\d+)/vote/$', 'polls.views.vote'),
> > > #    (r'^admin/', include(admin.site.urls)),
> > > #)
>
> > > urlpatterns = patterns('',
> > >     (r'^polls/', include('polls.urls')),
> > >     (r'^admin/', include(admin.site.urls)),
> > > )
>
> > > and I thought it had previously worked ok when I last tried to use it
> > > back on the 23rd. I would appreciate any help or direction in
> > > debugging this since I'm relatively new to both django and python.
> > > Thanks.
>
> > --
> > bloghttp://piotr.zalewa.info> > jobshttp://webdev.zalewa.info> > twithttp://twitter.com/zalun> > facehttp://facebook.com/zaloon-Hidequoted text -
>
> > - Show quoted text -

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 Jan. 4, 2011 18:59:28

h.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Syntax Error


OK. There were some problems with my django installation, due to the
OS upgrade on my machine, and things which were missing in at least
one environment variable. Since correcting these problems the basic
functionality of my tutorial site appears to be working again. Now I
appear to have at least one problem in my views.py file. Thanks for
the suggestion. It did helpme find the problem(s).

hank23

On Jan 4, 11:16 am, cewing <cew...@u.washington.edu> wrote:
> Is it possible that the problem is not in this urls.py, but rather in
> 'polls.urls'?
>
> I'd check line 20 there, just to see if there's an obvious python
> syntax error.
>
> HTH
>
> c
>
> On Jan 4, 8:08 am, hank23 <hversem...@stchas.edu> wrote:
>
>
>
> > After removing the commented code, saving urls.py, restarting the
> > server and then requesting the sites admin page now I get the admin
> > login screen. But after I type in my username and pw then it again
> > gives me the following screen:
>
> > TemplateSyntaxError at /admin/
> > Caught SyntaxError while rendering: invalid syntax (urls.py, line
> > 20)Request Method: GET
> > Request URL:http://127.0.0.1:8000/admin/> > Django Version: 1.2.3
> > Exception Type: TemplateSyntaxError
> > Exception Value: Caught SyntaxError while rendering: invalid syntax
> > (urls.py, line 20)
> > Exception Location: C:\Python27\lib\site-packages\django\utils
> > \importlib.py in import_module, line 35
> > Python Executable: C:\Python27\python.exe
> > Python Version: 2.7.1
> > Python Path:
> > Server time: Tue, 4 Jan 2011 09:45:54 -0600
>
> > and still references the same line in urls.py, which is confusing
> > because now it shouldn't have a line 20. Here's what urls.py currently
> > looks like:
>
> > from django.conf.urls.defaults import *
>
> > # Uncomment the next two lines to enable the admin:
> > from django.contrib import admin
> > admin.autodiscover()
>
> > urlpatterns = patterns('',
> >     (r'^polls/', include('polls.urls')),
> >     (r'^admin/', include(admin.site.urls)),
> > )
>
> > Could this problem be related to windows 7 environment variables not
> > being set properly? I ask because I was upgraded recently from Win XP
> > to Windows 7 and have been working to set up my environment variables
> > back to where they should be. I thought I had previously fixed all of
> > them, but maybe I missed something. Please advise. Thanks.
>
> > On Jan 4, 9:36 am, Piotr Zalewa <zal...@gmail.com> wrote:
>
> > > what happens if you'remove the commented lines?
>
> > > On 01/04/11 15:22, hank23 wrote:
>
> > > > Can someone explain to me what the following error is trying to tell
> > > > me:
>
> > > > SyntaxError at /polls/1
> > > > invalid syntax (urls.py, line 20)Request Method: GET
> > > > Request URL:http://127.0.0.1:8000/polls/1> > > > Django Version: 1.2.3
> > > > Exception Type: SyntaxError
> > > > Exception Value: invalid syntax (urls.py, line 20)
> > > > Exception Location: C:\Python27\lib\site-packages\django\utils
> > > > \importlib.py in import_module, line 35
> > > > Python Executable: C:\Python27\python.exe
> > > > Python Version: 2.7.1
> > > > Python Path:
> > > > Server time: Tue, 4 Jan 2011 09:12:32 -0600
>
> > > > The urls.py module that it is referring to looks like this:
>
> > > > from django.conf.urls.defaults import *
>
> > > > # Uncomment the next two lines to enable the admin:
> > > > from django.contrib import admin
> > > > admin.autodiscover()
>
> > > > #urlpatterns = patterns('',
> > > >     # Example:
> > > >     # (r'^mysite/', include('mysite.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'^polls/$',
> > > > 'polls.views.index'),
> > > > #    (r'^polls/(?P<poll_id>\d+)/$', 'polls.views.detail'),
> > > > #    (r'^polls/(?P<poll_id>\d+)/results/$', 'polls.views.results'),
> > > > #    (r'^polls/(?P<poll_id>\d+)/vote/$', 'polls.views.vote'),
> > > > #    (r'^admin/', include(admin.site.urls)),
> > > > #)
>
> > > > urlpatterns = patterns('',
> > > >     (r'^polls/', include('polls.urls')),
> > > >     (r'^admin/', include(admin.site.urls)),
> > > > )
>
> > > > and I thought it had previously worked ok when I last tried to use it
> > > > back on the 23rd. I would appreciate any help or direction in
> > > > debugging this since I'm relatively new to both django and python.
> > > > Thanks.
>
> > > --
> > > bloghttp://piotr.zalewa.info> > > jobshttp://webdev.zalewa.info> > > twithttp://twitter.com/zalun> > > facehttp://facebook.com/zaloon-Hidequotedtext -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 19th of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support