Re: Processing HTML form
On 2010-06-17, Bradley Hintze wrote: > I am on Mac OSX 10.6, server is apache. If I do get this working we > will move it to the main server which also serves apache, i believe.I > dont think I want a whole new server, I'd like to serve from the > apache framework if possible. There are a couple different ways to integrate python code into apache. You can use the normal CGI API where apache runs external programs written in Python: http://docs.python.org/library/cgi.html http://gnosis.cx/publish/programming/feature_5min_python.html http://www.cs.virginia.edu/~lab2q/lesson_1/ http://www.upriss.org.uk/python/PythonCourse.html Or you can embed Python into apache so that it's faster and you can do some more sophisticated stuff that's above my head: http://www.modpython.org/ http://onlamp.com/pub/a/apache/2003/04/10/apacheandpython.html More on both of the above at http://www.google.com/search?q=apache+python There are people on the list far more experienced with Python+Apache than I, so I'll leave it at that. -- Grant Edwards grant.b.edwardsYow! ... he dominates the at DECADENT SUBWAY SCENE. gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Processing HTML form
On Thu, Jun 17, 2010 at 1:15 PM, Bradley Hintze wrote: > I apologize in advance for my lack of knowledge, I really do not know. > I would guess server but I quite honestly I am not clear what an 'HTTP > client' or 'HTTP server' refers to. I am running a webpage and am > serving it locally for the moment. I have a program that is already > written in Python. I want to make the program available on the web > where I receive user input from HTML forms. The user input will then > be used as parameters for the program. I hope this clear things up. > > Thanks, > Bradley > HTTP Client = web browser. HTTP Server = the server, You'll probably want to use a framework like Django to help you with this- this is exactly what they were designed to do. What the frameworks do is let you map URLs to functions. Your form data will get sent to the server in a POST request, and the framework will hand that to your function as arguments. Then, your function will generate the web page (often using a template where you just fill in the blanks) and send that back to the browser. -- http://mail.python.org/mailman/listinfo/python-list
Re: Processing HTML form
I am on Mac OSX 10.6, server is apache. If I do get this working we will move it to the main server which also serves apache, i believe.I dont think I want a whole new server, I'd like to serve from the apache framework if possible. On Thu, Jun 17, 2010 at 4:34 PM, Grant Edwards wrote: > On 2010-06-17, Bradley Hintze wrote: > >> I apologize in advance for my lack of knowledge, I really do not know. >> I would guess server but I quite honestly I am not clear what an 'HTTP >> client' or 'HTTP server' refers to. I am running a webpage and am >> serving it locally for the moment. I have a program that is already >> written in Python. I want to make the program available on the web >> where I receive user input from HTML forms. The user input will then >> be used as parameters for the program. I hope this clear things up. > > Something that serves a web page is an HTTP server, so it sounds like > your program is going to be run by/in the HTTP server. There are > many, many different ways to do that. For starters you need to tell > us what OS you're using and what HTTP server you're using. > > Or do you want your program to _be_ an HTTP server? > > -- > Grant Edwards grant.b.edwards Yow! I'm having fun > at HITCHHIKING to CINCINNATI > gmail.com or FAR ROCKAWAY!! > -- > http://mail.python.org/mailman/listinfo/python-list > -- Bradley J. Hintze Graduate Student Duke University School of Medicine 801-712-8799 -- http://mail.python.org/mailman/listinfo/python-list
Re: Processing HTML form
On 2010-06-17, Bradley Hintze wrote: > I apologize in advance for my lack of knowledge, I really do not know. > I would guess server but I quite honestly I am not clear what an 'HTTP > client' or 'HTTP server' refers to. I am running a webpage and am > serving it locally for the moment. I have a program that is already > written in Python. I want to make the program available on the web > where I receive user input from HTML forms. The user input will then > be used as parameters for the program. I hope this clear things up. Something that serves a web page is an HTTP server, so it sounds like your program is going to be run by/in the HTTP server. There are many, many different ways to do that. For starters you need to tell us what OS you're using and what HTTP server you're using. Or do you want your program to _be_ an HTTP server? -- Grant Edwards grant.b.edwardsYow! I'm having fun at HITCHHIKING to CINCINNATI gmail.comor FAR ROCKAWAY!! -- http://mail.python.org/mailman/listinfo/python-list
Re: Processing HTML form
On 17 jun, 21:11, Bradley Hintze wrote: > Hi, > > I am a newbie to anything web related, I know a bit of HTML though. > I've been programing in python for a year or so so I know the language > at an intermediate level. I am wondering if its possible to get info > from an HTML form and pass it to my python code and return a page > based on the code executed. All of my web searches have been > fruitless as I quickly get lost in the jargon and perhaps not sure > what phrase i should search. Any help would be appreciated. > > Thank you, > Bradley Hi Bradley, If I understand correctly, you want to do the following: 1. Fill in a HTML form in a client (web browser) 2. Send the form to a webserver 3. Have the webserver extract the information from the form 4. Send the information to a python program for processing 5. Generate a new HTML page in python based on the information in step 4 6. Send the newly generated page back to the client Possible solutions depend a little on the constraints and/or options you have for the webserver. If you are free in your choices I would suggest to start with cherrypy (www.cherrypy.org) for a webserver. It is simple to start with, very powerfull and well documented. This would cover steps 3 and 4. For step 5 I suggest you either use the python builtin string template facility string.Template (for simple things). If you want more power have a look at Genshi http://genshi.edgewall.org. The two options I mention above help you to understand whats going on. If you feel comfortable with this, you can take a look at python web frameworks like Django or Turbogears (or many others). Good luck and keep us posted with what your progress. Regards, Marco -- http://mail.python.org/mailman/listinfo/python-list
Re: Processing HTML form
I apologize in advance for my lack of knowledge, I really do not know. I would guess server but I quite honestly I am not clear what an 'HTTP client' or 'HTTP server' refers to. I am running a webpage and am serving it locally for the moment. I have a program that is already written in Python. I want to make the program available on the web where I receive user input from HTML forms. The user input will then be used as parameters for the program. I hope this clear things up. Thanks, Bradley On Thu, Jun 17, 2010 at 3:46 PM, Grant Edwards wrote: > On 2010-06-17, Bradley Hintze wrote: > >> I am a newbie to anything web related, I know a bit of HTML though. >> I've been programing in python for a year or so so I know the language >> at an intermediate level. I am wondering if its possible to get info >> from an HTML form and pass it to my python code and return a page >> based on the code executed. All of my web searches have been >> fruitless as I quickly get lost in the jargon and perhaps not sure >> what phrase i should search. Any help would be appreciated. > > It's not clear what you want. Are you talking about Python code in an > HTTP client or an HTTP server? > > -- > Grant Edwards grant.b.edwards Yow! ... I have read the > at INSTRUCTIONS ... > gmail.com > -- > http://mail.python.org/mailman/listinfo/python-list > -- Bradley J. Hintze Graduate Student Duke University School of Medicine 801-712-8799 -- http://mail.python.org/mailman/listinfo/python-list
Re: Processing HTML form
On 2010-06-17, Bradley Hintze wrote: > I am a newbie to anything web related, I know a bit of HTML though. > I've been programing in python for a year or so so I know the language > at an intermediate level. I am wondering if its possible to get info > from an HTML form and pass it to my python code and return a page > based on the code executed. All of my web searches have been > fruitless as I quickly get lost in the jargon and perhaps not sure > what phrase i should search. Any help would be appreciated. It's not clear what you want. Are you talking about Python code in an HTTP client or an HTTP server? -- Grant Edwards grant.b.edwardsYow! ... I have read the at INSTRUCTIONS ... gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Processing HTML form
Hi, I am a newbie to anything web related, I know a bit of HTML though. I've been programing in python for a year or so so I know the language at an intermediate level. I am wondering if its possible to get info from an HTML form and pass it to my python code and return a page based on the code executed. All of my web searches have been fruitless as I quickly get lost in the jargon and perhaps not sure what phrase i should search. Any help would be appreciated. Thank you, Bradley -- http://mail.python.org/mailman/listinfo/python-list