Re: How can i do python form post request?

Discussion in 'Python' started by Thomas Jollans, Jul 3, 2012.

  1. On 07/03/2012 02:32 PM, gmspro wrote:
    > @Thomas,
    >
    >>First, you need to tell the web server to execute your Python script.

    > What you do next depends on how you've done that.
    >
    >>The simplest way is probably to pub p.py in your cgi-bin directory. This

    > could be in /var/www/cgi-bin or elsewhere, like /usr/lib/cgi-bin. You
    > may need to enable CGI, check the relevant documentation (or with the
    > admin).
    >
    >>When you've made sure the script is executed as a CGI script, you can

    > use the cgi module to get all the information you need.
    > http://docs.python.org/library/cgi.html
    >
    >>A better way to write web applications in Python is with WSGI. You can

    > run WSGI scripts in a number of ways, including CGI and other, more
    > efficient ways that integrate with the web server. Maybe somebody else
    > knows of a good tutorial on WSGI that they'll link here, otherwise, I'm
    > sure Google is your friend.
    >
    > I don't want to use CGI, i followed this example, this works fine,
    > http://webpython.codepoint.net/wsgi_request_parsing_post
    >
    > But the html is embeded there. But i want html form as a seperate file.
    > How can i do it?


    That makes absolutely no difference. Have you been able to run that
    example script? They're using wsgi.simple_server, of course, but you
    could start by removing that part and configuring mod_wsgi to run your
    WSGI script. http://ubuntuforums.org/showthread.php?t=833766 could be
    helpful, search the web for howtos on mod_wsgi to get started.

    Once you have your web server running the WSGI code, the rest should be
    trivial.

    >
    > form.html:
    > <form action="p.py" method="post">
    > <input type="text" id="id_text" name="name_text" />
    > <input type="submit" id="id_submit" name="name_submit" />
    > </form>
    >
    > Typing text when i click the submit button, browser prompts me to
    > download the p.py file.
    > That's not what i want. I want to execute the p.py file after click. Is
    > it possible in WSGI.
    >
    > I have installed: libapache2-mod-wsgi
    >
    > Any answer will be highly appreciate.
    > Thanks in advanced.
    >
    >
    >
    >
    Thomas Jollans, Jul 3, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Birtle
    Replies:
    2
    Views:
    1,989
    John Saunders
    Oct 16, 2003
  2. Don Glover the younger

    ASP, FORMS, POST METHOD And Post with out form(???)

    Don Glover the younger, Jul 13, 2003, in forum: ASP General
    Replies:
    0
    Views:
    434
    Don Glover the younger
    Jul 13, 2003
  3. J. Muenchbourg
    Replies:
    0
    Views:
    343
    J. Muenchbourg
    Aug 6, 2003
  4. fochie
    Replies:
    0
    Views:
    303
    fochie
    Feb 1, 2005
  5. Thomas Jollans

    Re: How can i do python form post request?

    Thomas Jollans, Jul 3, 2012, in forum: Python
    Replies:
    0
    Views:
    226
    Thomas Jollans
    Jul 3, 2012
Loading...

Share This Page