I spoke to soon. Using <Location "/"> in httpd works but of course it sets mysite as the root directory to my web site. I do not want to do that, at this time. If I use <Location "/mysite/"> and r'^mysite.polls in mysite/urls.py everything works up to the point of voting, when the second problem occurs. When I vote the URL changes from mysite/polls/8/ to polls/8/vote/ which produces a 404 error, this time in both the django and mod_python server. Although the mod_python server does not produce a django error page, the generic one is produced.
In the tutorial, is mysite suppose to be dropped from the url when voting? When using the admin and other aspects of polls, mysite is always in the url. It seems strange that this would change when using vote. This make me think I have a code error somewhere, but I have not been able to find it. I have done numerous comparisons between my code and what is listed in the django 0.96 tutorial, but nothing has caught my eye. Does anybody know where this occurs in the code? Jim On 7/23/07, James McManus <[EMAIL PROTECTED]> wrote: > > Using <Location "/"> in httpd worked, best in that it resolved the second > problem. I did have an additional problem in the last section of the > tutorial. In polls/urls.py I had to change: > > (r'^(?P<poll_id>\d+)/vote/$', 'mysite.polls.views.vote'), > > to > > (r'^(?P<object_id>\d+)/vote/$', 'mysite.polls.views.vote'), > > > for vote to work. Otherwise everything seems to be working. > > Thanks again for your help! > Jim > On 7/23/07, nick feng <[EMAIL PROTECTED]> wrote: > > > > Hi Hames, > > > > > > I am not sure about your request,but I suggest you to update your > > http.conf > > > > <Location "/"> > > SetHandler python-program > > PythonPath "['/var/www/django/'] + sys.path" > > PythonHandler django.core.handlers.modpython > > SetEnv DJANGO_SETTINGS_MODULE mysite.settings > > PythonDebug On > > </Location> > > If you used mysite, mysite should always in your urls, the mod_python > > will not found the right view if you did not add mysite in the urls. > > > > Best wishes, > > Nick > > > > ----- Original Message ----- > > *From:* James McManus <[EMAIL PROTECTED]> > > *To:* django-users@googlegroups.com > > *Sent:* Monday, July 23, 2007 12:35 PM > > *Subject:* mod_python problem? > > > > I am having two problems using django on an Apache server, with > > mod_python. The first problem I found a solution, but it may be causing > > other problems. In mysite/urls.py I am not able to use the ^ in: > > > > (r^'polls/', include(' mysite.polls.urls')), > > > > It causes a 404 error. I do not have this problem when I use the django > > server. If I remove ^ in: > > > > (r'polls/', include('mysite.polls.urls')), > > > > I do not get the error. In the mysite/polls/urls.py I use the ^ in: > > > > (r'^(?P<poll_id>\d+)/vote/$', 'vote'), > > > > and I do not get the 404 error. My mod_python setting in httpd are: > > > > <Location "/mysite/"> > > SetHandler python-program > > PythonPath "['/var/www/django/'] + sys.path" > > PythonHandler django.core.handlers.modpython > > SetEnv DJANGO_SETTINGS_MODULE mysite.settings > > PythonDebug On > > </Location> > > > > These setting appear to work, except for the one variation in > > mysite/urls.py. All functions in admin are working, and I am able to get to > > the point of voting in polls. However, that is where the second problem > > occurs. When I vote using the django server the url changes from: > > > > http://localhost:8080/mysite/polls/8/ > > > > to > > > > http://localhost:8080/polls/8/results/ > > > > and I get the expected results. If I vote without making a selection, > > the following url appears: > > > > http://localhost:8080/polls/8/vote/ > > > > and the page produces the expected message: You didn't select a choice. > > However, if I try voting using the mod_python server I get the vote url, > > without mysite: > > > > http://www.aratasystems.com/polls/8/vote/ > > > > and the message: The requested URL /polls/8/vote/ was not found on this > > server. > > > > Also when I use the django server I am able to drop mysite and use urls: > > > > > > http://localhost:8080/polls/ > > http://localhost:8080/admin/ > > > > But if drop mysite when using the mod_python server, I get the > > "requested URL" message. I have attempted to modify the mod_python setting > > in httpd, but in all cases it ends up producing errors in both the django > > and mod_python servers. Is there a way I can modify my httpd setting to > > prevent these problems? Or can I deal with this by changing code in mysite? > > > > Thanks > > Jim > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---