I'm not sure what your experience level is.  If you're a beginning
python/web developer it can be confusing.  I'm going to assume that's the
case. To others in the list, feel free to correct me if I get any of this
wrong. I'm no expert.

To build a web site you need to have a web server.  Most production sites
use Apache with a plug-in called mod_python that allows it to execute python
code and return the results.  In this case, you write python routines that
get called by Apache as a result of a user's request.  Your python code
looks at the request and returns an HTML page to Apache that then gets
returned to the end user as a result of the request.

If you're talking about a pure python solution, there are a number of
lightweight servers written in Python.  Twisted comes to mind as one of the
most popular.  You can write a Pyton based web server in only a few lines of
Twisted code.  I haven't done it but their demo and instructions are pretty
impressive.  These lightweight servers are great for development but are
usually not used in production systems due to security issues.  It's hard to
write a secure server. It's much easier to just use Apache.

If you're asking about how you generate HTML with Python, that's another
very deep subject.  You can do it directly by just using the Python
string/list functions to build a big string of HTML and return it to the
server. 

That quickly gets messy.  Most people use some sort of template language.  A
template language lets you build the HTML in a text editor and insert coded
place markers that get replaced by values you pass into the template
rendering engine.  There are lots of template engines available including
the one built into django itself.

Of course if you're working with any kind of data, you'll need an interface
to a database engine.  You can access a database directly through one of the
many Python based ODBC libraries. I use mxODBC from egenix.  It usually
works best though if you have a library that lets you work with your
database using object oriented python code.  Libraries that do that are
called ORM for Object Relational Maping.  Again, django has its own but
there are others, the most popular being SQLAlcemy.

Even using a template engine to create a web site can get cumbersome if
you're not careful to keep everything organized.  That's where a web
framework like django comes in. It provides a templating language, an ORM
and a project structure to help you quickly get a web site up and running in
a clean organized way.  It also has instructions for how to tie your web
application to whatever server you want.

I don't know if this answers your question. But if not, feel free to ask
more questions.


-----Original Message-----
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com]
On Behalf Of codecub
Sent: Saturday, April 17, 2010 1:28 PM
To: Django users
Subject: Re: how do you build an html website in python?

that's really unhelpful dude, i read through that and it doesnt even
help at all thats for software/applications not websites

-- 
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to