Your post showed the trailing url...anyway I agree with your diagnosis. With my noob knowledge of django, django tries to add a trailing slash to your url when you don't. I believe she does that by adding the trailing slash to the url and then asking the server to redirect to the url which is the reason why the development server logs show 301 status. However, when a 301 is gotten in response to a request and the request method wasn't GET or HEAD, the client is expected to ask the user before redirecting. If there is no automatic addition of the trailing slash, the server will return a 500 instead because django would be able to find the url in your given pattern and raise an error. My guess is that maybe django explicitly does the redirection by sending a GET. I guess this is one of the times we need to check the guts of django to understand her more. However, if you believe you simply won't be able to cope with the trailing slash, you could change your url pattern to exclude the trailing slash though I don't know if that has side effects.....that's if you must absolutely hard code the url
On 9/21/11, Fabio Natali <fa...@fnstudio.it> wrote: > On 09/20/2011 07:15 PM, dm03514 wrote: >> Fabio in your dev server output is it saying the type of request is >> get? >> ARe you accessing "/method/" through your form or are you just >> directing your webserver to http://192.168.0.2:8000/method/??? > > Hi dm03514 and thanks for your help! > > Thanks to your suggestion I managed to resolve my issue. I looked at my > development server logs and noticed 2 lines: > > [20/Sep/2011 12:17:27] "POST /method HTTP/1.1" 301 0 > [20/Sep/2011 12:17:27] "GET /method/ HTTP/1.1" 200 3 > > I guess the lack of a trailing slash in my url was causing some sort of > internal redirection. That redirection eventually caused the loss of > POST stuff. > > I was using this: > <form method="post" action="http://192.168.0.2:8000/method"> > I changed that to: > <form method="post" action="http://192.168.0.2:8000/method/"> > and everything was fixed. > > Don't you think this is too fragile and error prone? I guess I may > forget the trailing slash again in the future and that will mean the > break of everything... Is there any best practice for this? > > Thanks! Greetings, Fabio. > > -- > Fabio Natali FNstudio > > -- > 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 > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Sent from my mobile device -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.