Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'executed': 0.07; 'skip:/ 10': 0.07; 'subject:form': 0.07; 'scripts': 0.09; 'subject:How': 0.09; 'python': 0.09; 'other,': 0.09; 'script,': 0.09; 'subject:python': 0.11; 'elsewhere,': 0.16; 'received:192.168.1.50': 0.16; 'script?': 0.16; 'seperate': 0.16; 'simplest': 0.16; 'wsgi': 0.16; 'wsgi.': 0.16; 'wrote:': 0.17; 'directory.': 0.17; 'script.': 0.17; 'subject:request': 0.17; 'typing': 0.17; 'code,': 0.18; '(or': 0.18; 'module': 0.19; 'followed': 0.20; 'otherwise,': 0.20; 'file.': 0.20; 'button,': 0.22; 'fine,': 0.22; 'friend.': 0.22; 'example': 0.23; 'somebody': 0.23; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'integrate': 0.27; 'there.': 0.28; 'rest': 0.28; 'run': 0.28; 'cgi': 0.29; "they'll": 0.29; 'probably': 0.29; "i'm": 0.29; 'maybe': 0.29; 'knows': 0.30; 'that.': 0.30; 'server.': 0.32; 'url:python': 0.32; 'file': 0.32; 'running': 0.32; 'could': 0.32; 'to:addr:python-list': 0.33; 'tutorial': 0.33; 'text': 0.34; 'done': 0.34; 'thanks': 0.34; 'server': 0.35; 'pm,': 0.35; 'subject:?': 0.35; 'next': 0.35; 'but': 0.36; 'url:org': 0.36; 'depends': 0.36; 'url:library': 0.36; 'should': 0.36; 'possible': 0.37; 'execute': 0.37; 'subject:: ': 0.38; 'url:docs': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'google': 0.39; 'received:192.168': 0.40; 'enable': 0.60; 'your': 0.60; 'link': 0.60; "you've": 0.61; 'received:62': 0.62; 'information': 0.63; 'more': 0.63; 'url:t': 0.65; 'started.': 0.65; 'url:cgi': 0.65; 'click': 0.76; 'absolutely': 0.84; 'click.': 0.84; 'difference.': 0.84; 'from:addr:t': 0.84; 'received:62.75': 0.84; 'url:php': 0.86 Date: Tue, 03 Jul 2012 14:58:11 +0200 From: Thomas Jollans User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: How can i do python form post request? References: <1341318760.22221.YahooMailClassic@web164606.mail.gq1.yahoo.com> In-Reply-To: <1341318760.22221.YahooMailClassic@web164606.mail.gq1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 58 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1341320293 news.xs4all.nl 6863 [2001:888:2000:d::a6]:39296 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:24818 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: >
> > >
> > 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. > > > >