Try running the server locally using the devserver and posting to it. You
can invoke python's debugger when the post is recieved on the server side by
adding some code like the following:

import pdb;pdb.set_trace()

On Wed, Apr 14, 2010 at 7:30 AM, bfrederi <brfrederi...@gmail.com> wrote:

> I'm attempting to re-route user posts from one django instance to
> another. I'm doing this by receiving a user's post request, and then
> sending the post to another django instance as a post request (sorry
> if this is confusing).
>
> I'm having trouble making a post request to a django form using
> urllib2.urlopen. I'm on revision 12523 of django trunk, so I used the
> @csrf_exempt decorator for the view that receives the post. When I
> tried to post to the form, it would return a 500 error, and not log
> the error in apache's error log for some reason. So I decided to have
> my receiving view return an Http404 when it receives a post request.
> This time it returned a "HTTP Error 403: Forbidden", and still the
> receiving django instance doesn't log any error in apache's error log.
>
> I think the issue is, that no matter where I post from, or what I used
> to send the post request with, if the post request isn't from the same
> server, and submitted from the same page, it won't allow me to post to
> it. I've even changed the user-agent and content type in my post
> request, and the errors are the same.
>
> Here is the post request:
>
> #Create the headers
> headers = {
>    'Content-Type' : 'text/html; charset=UTF-8',
>    'User-Agent': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9)
> Gecko/20100401 Ubuntu/9.10 (karmic) Firefox/3.5.9',
>    }
> #Create the POST data
> post_data = {
>    'email_address' : 'f...@gmail.com',
>    'user_feedback' : 'Hello World',
>    }
> #urlencode the post data
> data = urllib.urlencode(post_data)
> url = 'http://www.example.com'
> #Create the request
> req = urllib2.Request(url, data, headers)
> #raise IOError, url
> #Send the request
> response = urllib2.urlopen(req)
>
> Here is the receiving form:
> <form method="post">
>        <p>
>        <label>Email Address:</label><br/>
>        <span class="quiet small">email address should be in the form
> of per...@domain.com</span><br />
>        <input id="email_address" type="text" name="email_address"
> maxlength="100" /><span id="validEmail"></span><br/>
>        </p>
>        <p>
>        <label>Feedback:</label><br/>
>        <textarea id="user_feedback" rows="5" cols="70"
> name="user_feedback"></textarea>
>        </p>
>        <p>
>        <input value="Submit" type="submit" class="submit" />
>        <input value="Reset" type="reset" class="submit" />
>        </p>
> </form>
>
> The receiving view is just a simple view with @csrf_exempt as a
> decorator. Any idea what the issue might be?
>
> --
> 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.
>
>


-- 
=======================================
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
=======================================

-- 
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.

Reply via email to