Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

where do I begin with web programming in python?

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


needin4mation at gmail

May 1, 2008, 2:25 PM

Post #1 of 11 (183 views)
Permalink
where do I begin with web programming in python?

I have been to the main python site, but am still confused. I have
been using .net, so it may be obvious how to do this to everyone
else. I am aware there are various frameworks (Django, Pylons, etc.),
but I would like to know how to create web pages without these. If I
have mod_python or fastcgi on apache, where do I start? I don't have
clue where to begin to create a web page from scratch in python. I am
sure I will want to access database, etc., all the "normal" stuff, I
just want to do it myself as opposed to the frameworks, for learning.

Thank you for any help.
--
http://mail.python.org/mailman/listinfo/python-list


kyosohma at gmail

May 1, 2008, 2:31 PM

Post #2 of 11 (177 views)
Permalink
Re: where do I begin with web programming in python? [In reply to]

On May 1, 4:25 pm, jmDesktop <needin4mat...@gmail.com> wrote:
> I have been to the main python site, but am still confused.  I have
> been using .net, so it may be obvious how to do this to everyone
> else.  I am aware there are various frameworks (Django, Pylons, etc.),
> but I would like to know how to create web pages without these.  If I
> have mod_python or fastcgi on apache, where do I start?  I don't have
> clue where to begin to create a web page from scratch in python.  I am
> sure I will want to access database, etc., all the "normal" stuff, I
> just want to do it myself as opposed to the frameworks, for learning.
>
> Thank you for any help.

The web frameworks make it a lot easier. But you can use the httplib
modules. You should check out the wiki: http://wiki.python.org/moin/WebProgramming

There's also a couple of books on the topic: "Python Web Programming"
by Steve Holden, and "Web Programming in Python" by Thiruvathukal.

Check out the cgi-type stuff especially.

Hope that helps some.

Mike
--
http://mail.python.org/mailman/listinfo/python-list


lists at cheimes

May 1, 2008, 2:45 PM

Post #3 of 11 (177 views)
Permalink
Re: where do I begin with web programming in python? [In reply to]

jmDesktop schrieb:
> I have been to the main python site, but am still confused. I have
> been using .net, so it may be obvious how to do this to everyone
> else. I am aware there are various frameworks (Django, Pylons, etc.),
> but I would like to know how to create web pages without these. If I
> have mod_python or fastcgi on apache, where do I start? I don't have
> clue where to begin to create a web page from scratch in python. I am
> sure I will want to access database, etc., all the "normal" stuff, I
> just want to do it myself as opposed to the frameworks, for learning.

I highly recommend WSGI instead of mod_python or (fast)cgi. I've heard
only bad things about mod_python over the past years and CGI is totally
old school.

Check out Python Paste, CherryPy and Django. You can also try the Zope,
Zope3 and Plone world but Zope is usually for larger and complex
applications.

Most frameworks come with their own little web server for development, too.

Christian
--
http://mail.python.org/mailman/listinfo/python-list


Graham.Dumpleton at gmail

May 1, 2008, 4:13 PM

Post #4 of 11 (178 views)
Permalink
Re: where do I begin with web programming in python? [In reply to]

On May 2, 7:45 am, Christian Heimes <li...@cheimes.de> wrote:
> jmDesktop schrieb:
>
> > I have been to the main python site, but am still confused. I have
> > been using .net, so it may be obvious how to do this to everyone
> > else. I am aware there are various frameworks (Django, Pylons, etc.),
> > but I would like to know how to create web pages without these. If I
> > havemod_pythonor fastcgi on apache, where do I start? I don't have
> > clue where to begin to create a web page from scratch in python. I am
> > sure I will want to access database, etc., all the "normal" stuff, I
> > just want to do it myself as opposed to the frameworks, for learning.
>
> I highly recommend WSGI instead ofmod_pythonor (fast)cgi. I've heard
> only bad things aboutmod_pythonover the past years and CGI is totally
> old school.
>
> Check out Python Paste, CherryPy and Django. You can also try the Zope,
> Zope3 and Plone world but Zope is usually for larger and complex
> applications.
>
> Most frameworks come with their own little web server for development, too.

I'd also suggest avoiding coding anything directly to mod_python and
instead base things on WSGI. You can still run it on mod_python with a
suitable adapter, but you can also run it with mod_wsgi, mod_fastcgi,
or using pure Python web servers such as the one in Paste as well.

For a low level nuts and bolts (anti framework) approach I'd suggest
looking at:

http://dev.pocoo.org/projects/werkzeug/

This gives you all the basic components, but it is really up to you as
to how you put them together, which seems to be what you want to be
able to do.

Graham

--
http://mail.python.org/mailman/listinfo/python-list


george.sakkis at gmail

May 1, 2008, 4:50 PM

Post #5 of 11 (174 views)
Permalink
Re: where do I begin with web programming in python? [In reply to]

On May 1, 7:13 pm, Graham Dumpleton <Graham.Dumple...@gmail.com>
wrote:
> On May 2, 7:45 am, Christian Heimes <li...@cheimes.de> wrote:
>
>
>
> > jmDesktop schrieb:
>
> > > I have been to the main python site, but am still confused.  I have
> > > been using .net, so it may be obvious how to do this to everyone
> > > else.  I am aware there are various frameworks (Django, Pylons, etc.),
> > > but I would like to know how to create web pages without these.  If I
> > > havemod_pythonor fastcgi on apache, where do I start?  I don't have
> > > clue where to begin to create a web page from scratch in python.  I am
> > > sure I will want to access database, etc., all the "normal" stuff, I
> > > just want to do it myself as opposed to the frameworks, for learning.
>
> > I highly recommend WSGI instead ofmod_pythonor (fast)cgi. I've heard
> > only bad things aboutmod_pythonover the past years and CGI is totally
> > old school.
>
> > Check out Python Paste, CherryPy and Django. You can also try the Zope,
> > Zope3 and Plone world but Zope is usually for larger and complex
> > applications.
>
> > Most frameworks come with their own little web server for development, too.
>
> I'd also suggest avoiding coding anything directly to mod_python and
> instead base things on WSGI. You can still run it on mod_python with a
> suitable adapter, but you can also run it with mod_wsgi, mod_fastcgi,
> or using pure Python web servers such as the one in Paste as well.
>
> For a low level nuts and bolts (anti framework) approach I'd suggest
> looking at:
>
>  http://dev.pocoo.org/projects/werkzeug/
>
> This gives you all the basic components, but it is really up to you as
> to how you put them together, which seems to be what you want to be
> able to do.

Or if you don't want to use any 3rd party package and have Python 2.5,
you may start from http://www.xml.com/pub/a/2006/09/27/introducing-wsgi-pythons-secret-web-weapon.html.
Here's the standard "Hello world!" example:

from wsgiref.simple_server import make_server

def application(environ, start_response):
start_response('200 OK',[('Content-type','text/html')])
return ['<html><body>Hello World!</body></html>']

httpd = make_server('', 8000, application)
print "Serving HTTP on port 8000..."
httpd.serve_forever()

and point your browser to http://localhost:8000/

HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list


"http://phr.cx" at NOSPAM

May 1, 2008, 5:20 PM

Post #6 of 11 (174 views)
Permalink
Re: where do I begin with web programming in python? [In reply to]

jmDesktop <needin4mation[at]gmail.com> writes:
> I am aware there are various frameworks (Django, Pylons, etc.),
> but I would like to know how to create web pages without these. If I
> have mod_python or fastcgi on apache, where do I start? I don't have
> clue where to begin to create a web page from scratch in python. I am
> sure I will want to access database, etc., all the "normal" stuff, I
> just want to do it myself as opposed to the frameworks, for learning.

I didn't notice anyone mentioning the simplest answer of them all:
write an old fashioned cgi using python's cgi module.
--
http://mail.python.org/mailman/listinfo/python-list


bvidinli at gmail

May 2, 2008, 12:07 AM

Post #7 of 11 (160 views)
Permalink
Re: where do I begin with web programming in python? [In reply to]

i also asked same question in this list last week.
i found http://www.cherrypy.org/ to be most suitable for me.
it is basic, easy, pure...
it contains its own webserver, very easy to start.

others have many framworks, structures, classes many many..
i wanted a pure web programming system , i found cherrypy.

see you.


2008/5/2 jmDesktop <needin4mation[at]gmail.com>:
> I have been to the main python site, but am still confused. I have
> been using .net, so it may be obvious how to do this to everyone
> else. I am aware there are various frameworks (Django, Pylons, etc.),
> but I would like to know how to create web pages without these. If I
> have mod_python or fastcgi on apache, where do I start? I don't have
> clue where to begin to create a web page from scratch in python. I am
> sure I will want to access database, etc., all the "normal" stuff, I
> just want to do it myself as opposed to the frameworks, for learning.
>
> Thank you for any help.
> --
> http://mail.python.org/mailman/listinfo/python-list
>



--
Ý.Bahattin Vidinli
Elk-Elektronik Müh.
-------------------
iletisim bilgileri (Tercih sirasina gore):
skype: bvidinli (sesli gorusme icin, www.skype.com)
msn: bvidinli[at]iyibirisi.com
yahoo: bvidinli

+90.532.7990607
+90.505.5667711
--
http://mail.python.org/mailman/listinfo/python-list


bbxx789_05ss at yahoo

May 2, 2008, 1:34 AM

Post #8 of 11 (160 views)
Permalink
Re: where do I begin with web programming in python? [In reply to]

On May 1, 3:25 pm, jmDesktop <needin4mat...@gmail.com> wrote:
> I have been to the main python site, but am still confused.  I have
> been using .net, so it may be obvious how to do this to everyone
> else.  I am aware there are various frameworks (Django, Pylons, etc.),
> but I would like to know how to create web pages without these.  If I
> have mod_python or fastcgi on apache, where do I start?  I don't have
> clue where to begin to create a web page from scratch in python.  I am
> sure I will want to access database, etc., all the "normal" stuff, I
> just want to do it myself as opposed to the frameworks, for learning.
>
> Thank you for any help.

Directions for a simple CGI script:

1) Start apache.

2) Use a text editor to create a webpage with a link:

<html>
<head>
<title>Python CGI Test</title>
</head>

<body>
<div>
<a href="http://localhost/cgi-bin/first.py">click me</a>
</div>
</body>

</html>

Save that file with a .htm extension anywhere on your computer, e.g.
name the file test.htm and save it in C:\My Documents.


3) The value of the link's href attribute is a special url. The url
starts with "http://localhost", or it may need to start with something
like http://localhost:8080" depending on what port number you
installed Apache on. If you used the default port when you installed
Apache, then the first part of the url will be "http:/localhost".

The rest of the url is the relative path to your cgi script. The path
is relative to your Apache2 folder. For instance, my directory
structure looks like this:

Apache2
----htdocs
----cgi-bin
--------first.py
----etc.

So the relative path to my cgi script is "/cgi-bin/first.py".

4) Create a cgi script:

#!/usr/bin/env python

#For Windows, instead of the above line use
#something like: #!C:\Python25\python.exe
#instead. The path after "#!" should be the
#path to wherever python.exe is on your computer.

import cgitb; cgitb.enable()

#The above line will cause error messages to
#be sent to your browser, which is helpful for
#debugging. Otherwise, your browser will just
#show a blank page when there is an error in your
#script

print "Content-type: text/html"
print
print "<h1>Hello World</h1>"


The first print statement is the minimum header you need when
responding to a web page. After you print all the headers you desire,
then you need to print a blank line. After the blank line, you print
the html that you want the browser to display.


5) On Unix: you have to set the file permissions for your cgi script.
Everyone must be able to read and execute your cgi script:

$ chmod 755 first.py


6) Start your web browser, and click on File>Open and navigate to
your .htm file. When your html page opens in your browser, click on
the link. The link will call your python cgi script, the cgi script
will respond my sending some html to your browser, then your browser
will display the html.


--
http://mail.python.org/mailman/listinfo/python-list


andrei.zavidei at gmail

May 2, 2008, 7:18 AM

Post #9 of 11 (159 views)
Permalink
Re: where do I begin with web programming in python? [In reply to]

On May 2, 10:07 am, bvidinli <bvidi...@gmail.com> wrote:
> i also asked same question in this list last week.
> i foundhttp://www.cherrypy.org/to be most suitable for me.
> it is basic, easy, pure...
> it contains its own webserver, very easy to start.
>
> others have many framworks, structures, classes many many..
> i wanted a pure web programming system , i found cherrypy.
>
> see you.
>
> 2008/5/2 jmDesktop <needin4mat...@gmail.com>:
>
> > I have been to the main python site, but am still confused.  I have
> >  been using .net, so it may be obvious how to do this to everyone
> >  else.  I am aware there are various frameworks (Django, Pylons, etc.),
> >  but I would like to know how to create web pages without these.  If I
> >  have mod_python or fastcgi on apache, where do I start?  I don't have
> >  clue where to begin to create a web page from scratch in python.  I am
> >  sure I will want to access database, etc., all the "normal" stuff, I
> >  just want to do it myself as opposed to the frameworks, for learning.
>
> >  Thank you for any help.
> >  --
> >  http://mail.python.org/mailman/listinfo/python-list
>
> --
> Ý.Bahattin Vidinli
> Elk-Elektronik Müh.
> -------------------
> iletisim bilgileri (Tercih sirasina gore):
> skype: bvidinli (sesli gorusme icin,www.skype.com)
> msn: bvidi...@iyibirisi.com
> yahoo: bvidinli
>
> +90.532.7990607
> +90.505.5667711

I agree. Try cherrypy. I was able to write simple issue tracking
system for my project with basic web interface within 2 weeks.
Prior to this I had no web development experience at all. It was
really easy with cherrypy to start.
--
http://mail.python.org/mailman/listinfo/python-list


cmpython at gmail

May 2, 2008, 12:53 PM

Post #10 of 11 (155 views)
Permalink
Re: where do I begin with web programming in python? [In reply to]

On May 2, 10:18 am, "andrei.zavi...@gmail.com"
<andrei.zavi...@gmail.com> wrote:
> On May 2, 10:07 am, bvidinli <bvidi...@gmail.com> wrote:
>
>
>
> > i also asked same question in this list last week.
> > i foundhttp://www.cherrypy.org/tobe most suitable for me.
> > it is basic, easy, pure...
> > it contains its own webserver, very easy to start.
>
> > others have many framworks, structures, classes many many..
> > i wanted a pure web programming system , i found cherrypy.
>
> > see you.
>
> > 2008/5/2 jmDesktop <needin4mat...@gmail.com>:
>
> > > I have been to the main python site, but am still confused. I have
> > > been using .net, so it may be obvious how to do this to everyone
> > > else. I am aware there are various frameworks (Django, Pylons, etc.),
> > > but I would like to know how to create web pages without these. If I
> > > have mod_python or fastcgi on apache, where do I start? I don't have
> > > clue where to begin to create a web page from scratch in python. I am
> > > sure I will want to access database, etc., all the "normal" stuff, I
> > > just want to do it myself as opposed to the frameworks, for learning.
>
> > > Thank you for any help.
> > > --
> > > http://mail.python.org/mailman/listinfo/python-list
>
> > --
> > Ý.Bahattin Vidinli
> > Elk-Elektronik Müh.
> > -------------------
> > iletisim bilgileri (Tercih sirasina gore):
> > skype: bvidinli (sesli gorusme icin,www.skype.com)
> > msn: bvidi...@iyibirisi.com
> > yahoo: bvidinli
>
> > +90.532.7990607
> > +90.505.5667711
>
> I agree. Try cherrypy. I was able to write simple issue tracking
> system for my project with basic web interface within 2 weeks.
> Prior to this I had no web development experience at all. It was
> really easy with cherrypy to start.


Really? I tried CherryPy for a few minutes--totally 100% new to
web programming--and though I was pleased at the very basic "Hello,
World!" tutorial, I was unable to figure out how to use the more
advanced tutorials that come with the package. Could you suggest
how one could learn? I have experience with Python and GUI app
development, zero on web apps, but want to make widget-having web
apps which uses Python as the logic.

Any tips would be appreciated!

Also, beyond just running a small test web app with the "server"
running on my own computer, what is a basic way to try it out
actually on the web? Thanks!
--
http://mail.python.org/mailman/listinfo/python-list


Sam.Dutton at itn

May 25, 2008, 12:38 PM

Post #11 of 11 (94 views)
Permalink
RE: where do I begin with web programming in python? [In reply to]

This doesn't really answer your question, but you might want to consider Google App Engine.

http://code.google.com/appengine/

Sam Dutton






SAM DUTTON
SENIOR SITE DEVELOPER

200 GRAY'S INN ROAD
LONDON
WC1X 8XZ
UNITED KINGDOM
T +44 (0)20 7430 4496
F
E Sam.Dutton[at]itn.co.uk
WWW.ITN.CO.UK

P Please consider the environment. Do you really need to print this email?
Please Note:



Any views or opinions are solely those of the author and do not necessarily represent
those of Independent Television News Limited unless specifically stated.
This email and any files attached are confidential and intended solely for the use of the individual
or entity to which they are addressed.
If you have received this email in error, please notify postmaster[at]itn.co.uk

Please note that to ensure regulatory compliance and for the protection of our clients and business,
we may monitor and read messages sent to and from our systems.

Thank You.

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.