Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old March 31st, 2004, 08:43 PM
caroundw5h caroundw5h is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Canada
Posts: 181 caroundw5h User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 55 m 34 sec
Reputation Power: 0
Python and the web

Couple questions to ask:

1) building a website on my desktop and everytime i write the html code i have to save it both as text and as .htm its kind of annoying. isn't there anyway to kind of automate it.

2)I want to use python on the server side and i'ld like to have a a from submission go to say clien_parser.py. after i link it to the script does it go there automatically or do i need to be using the cgi bin info from python. Basically the question is how do i get the form to go to the script and how do i get python to read and process the info.

3)I forgot the third. i'll remember:
__________________
"In theory, there is no difference between theory and practice.
But, in practice, there is."


Reply With Quote
  #2  
Old March 31st, 2004, 08:51 PM
jimmy2k1 jimmy2k1 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 89 jimmy2k1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 48 m 50 sec
Reputation Power: 7
Quote:
Originally Posted by caroundw5h
Couple questions to ask:

1) building a website on my desktop and everytime i write the html code i have to save it both as text and as .htm its kind of annoying. isn't there anyway to kind of automate it.

2)I want to use python on the server side and i'ld like to have a a from submission go to say clien_parser.py. after i link it to the script does it go there automatically or do i need to be using the cgi bin info from python. Basically the question is how do i get the form to go to the script and how do i get python to read and process the info.

3)I forgot the third. i'll remember:

1) I don't understand this part, why do you have to save it as .txt?

2) you direct the form data to the script in your HTML form

example: <form action="clien_parser.py" name="pyform" method="post">

if you want to do CGI with python, read the devshed tutorial http://www.devshed.com/c/a/Python/W...rams-in-Python/

Reply With Quote
  #3  
Old March 31st, 2004, 08:54 PM
caroundw5h caroundw5h is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Canada
Posts: 181 caroundw5h User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 55 m 34 sec
Reputation Power: 0
Quote:
Originally Posted by jimmy2k1
1) I don't understand this part, why do you have to save it as .txt?

2) you direct the form data to the script in your HTML form

example: <form action="clien_parser.py" name="pyform" method="post">

if you want to do CGI with python, read the devshed tutorial http://www.devshed.com/c/a/Python/W...rams-in-Python/

Thank you for answering.

I first save it as text so that i can manipulate easier. I've read some tutorials that told me if i want to do so i need to save it as a text and not htm.

2) in your example name = "pyform" is that the mandatory attribute or generic?

3)Thank you for you link i appreaciate it.

Reply With Quote
  #4  
Old April 1st, 2004, 01:58 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 19 m 5 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Well, you dont have to write anything to a text file and i can't see how it could be easier since data read in from a file is just a string. So if you just want to manipulate it then theres no need, but then maybe theres something your not telling. And just to clear things up a little , the file extention means nothing to Python so anything you like...

What server are you trying to run this from anyway or do you just want to have the app serverless, if so then you should look at the CGIHTTPServer module.

http://www.python.org/doc/2.3.3/lib...HTTPServer.html

Hope this helps.

Mark

P.S. The name of the form (like all other element names) is generic
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #5  
Old April 1st, 2004, 07:53 AM
caroundw5h caroundw5h is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Canada
Posts: 181 caroundw5h User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 55 m 34 sec
Reputation Power: 0
Quote:
Originally Posted by netytan
Well, you dont have to write anything to a text file and i can't see how it could be easier since data read in from a file is just a string. So if you just want to manipulate it then theres no need, but then maybe theres something your not telling. And just to clear things up a little , the file extention means nothing to Python so anything you like...

What server are you trying to run this from anyway or do you just want to have the app serverless, if so then you should look at the CGIHTTPServer module.

http://www.python.org/doc/2.3.3/lib...HTTPServer.html

Hope this helps.

Mark

P.S. The name of the form (like all other element names) is generic
Thank you for your reply Net. I'm creating the webpage on my personal computer, i have not uploaded it to server as yet. however i would like to be able to use the cgi module and see how it is used and without uploading my page to a server. it seems that is what you were sayingwith the CGIHTTPSERVER Module, so i'll check it out.

I still don't get what your talking about with the text file though. I want to create a webpage so i go into notepad and right the necessary script, then i save it as htm. is that what your saying. what happens when i want to edit the script? then i have to copy and paste it onto notepad manipulate it and then save it again.

If i save it as text, all i do is manipulate the text file and save a copy as htm and as text, that way i don't do any copy and paste. hope this clears it up and what i do. If there is a better way i'ld love to hear it as you can see i'm a web developing novice.
thanks again for your reply.

Reply With Quote
  #6  
Old April 1st, 2004, 08:48 AM
sfb sfb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 447 sfb User rank is Corporal (100 - 500 Reputation Level)sfb User rank is Corporal (100 - 500 Reputation Level)sfb User rank is Corporal (100 - 500 Reputation Level)sfb User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 1 h 43 m 45 sec
Reputation Power: 9
Quote:
I want to create a webpage so i go into notepad and right the necessary script, then i save it as htm. is that what your saying. what happens when i want to edit the script? then i have to copy and paste it onto notepad manipulate it and then save it again.


When you want to edit the file, open the HTML file in notepad.
Or, better yet, don't close notepad, just save the file before viewing the changes.

Even better, don't use notepad. Try EditPlus, or Textpad or one of the other free text editors that do syntax highlighting, etc.

Reply With Quote
  #7  
Old April 1st, 2004, 08:52 AM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 7
Send a message via MSN to Grim Archon
The content of html files is just plain text.

You can edit and save html files using Notepad.

There are plenty of Free Text Editors on the web which make editing html files easier. For example - when you use the open file dialog they show your html files without you having to change the file type settings.

Your tutorial probably warned you not to use a word processor program like Wordpad or Word. They can add funny codes and mess things up.
__________________
*** Experimental Python Markup CGI V2 ***

Reply With Quote
  #8  
Old April 1st, 2004, 06:35 PM
caroundw5h caroundw5h is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Canada
Posts: 181 caroundw5h User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 55 m 34 sec
Reputation Power: 0
Quote:
Originally Posted by sfb
When you want to edit the file, open the HTML file in notepad.
Or, better yet, don't close notepad, just save the file before viewing the changes.

Even better, don't use notepad. Try EditPlus, or Textpad or one of the other free text editors that do syntax highlighting, etc.
Tahnk you so much, that saves me soooo much time.

Now next question: Can i use PWS on windows to turn my computer into a server, that way i can test out the cgi capabilities. I'm on windows xp. I hope this isn't a stupid question but i've heard about it, thats why.

Last edited by caroundw5h : April 1st, 2004 at 06:37 PM.

Reply With Quote
  #9  
Old April 3rd, 2004, 01:53 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 19 m 5 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
In theory yes although i havn't used it since Apache beats it hads down every time! So if you can get Apache, you wont regret it

Mark.

Reply With Quote
  #10  
Old April 3rd, 2004, 04:46 AM
DevCoach DevCoach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: London, England
Posts: 1,195 DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 13 h 31 m 54 sec
Reputation Power: 252
M$ say that PWS is not supported on Windows XP, and I have heard reports that it will not run at all. On the other hand I could never get PWS to run on Windows 98 either.

My advice is to avoid it like the plague and use a decent web server like Apache. If you need ASP functionality then take a look at AHTML from Selisoft (http://www.selisoft.com/en/ahtml/), which does a reasonable job of providing ASP emulation under Apache and other servers. There are other products that do this but they are priced in the hundreds of dollars range, while AHTML is about $30.

Dave - The Developers' Coach

Reply With Quote
  #11  
Old April 3rd, 2004, 10:32 AM
caroundw5h caroundw5h is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Canada
Posts: 181 caroundw5h User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 55 m 34 sec
Reputation Power: 0
Thank you for your responses. I guess what i'm asking is can i run apache or a server on my home computer and still use it as a personal computer. I only want to test the cgi output. I will take a look at apache however. Thank you.

While we are at it. Can you tell me exactly what a Server is. I know it is a dedicated computer to hold info, but why do you need speacial sofware like apache. technically isn't being connected to the net enough? i mean ppl want to see your home page, they can just log on to your site, that you store on your own computer right? what does apache, cheetah and all the others do that is so speacial?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Python and the web


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |