[Tutor] Creating A Simple Blog System Using Python Programming
Wayne Werner
waynejwerner at gmail.com
Sat Jun 26 15:49:52 CEST 2010
On Fri, Jun 25, 2010 at 11:41 PM, F C <amarantos at live.com.au> wrote:
> Hi there,
>
> - I have recently decided to learn Python.
> - It is my first programming language.
> - I am new to programming.
> - I know XHTML and CSS, and a few lines of PHP.
> - I only started learning a couple of days ago.
>
Well congratulations on starting what many of us feel is a wonderful
journey! And probably most of us feel is an excellent choice for starting
out.
> What I want to do is create a simple blog system.
> Where I can
> - create posts, edit them and post them online
>
An ambitious goal... And a fairly achievable one (though of course you still
have plenty to learn at this point. I'd guess most of us who have been
programming in Python for a few years could probably knock something out in
a day or two, but I wouldn't expect results near that quick as you'll have
to learn both programming concepts and a language. But Python excels at
being a simple language to learn so you can ignore more of the "advanced"
programming topics until you're ready)
>
> Thus far, people have pointed me to frameworks.
> From what I see, the framework does the work for you...
> I want to code the blog from scratch...after all - I want to learn the
> language - I don't want something to do the work for me.
>
> I truly do not know where to start, because most of the tutorials are
> segmented, and I don't know how to structure the
> program, let alone what commands to include.
>
> I would appreciate it if someone could give me some structure advice on how
> to tackle this.
>
Well, here's what I would do:
1) Build a *simple* web form - an entry for a title, a text area for the
text of the post, and a submit/save button. You can add features later as
you feel you need them (like a login window), but for now simple is better.
2) Write a program that connects to a database (SQLite is included in most
Python installs) and allows you to insert and retrieve posts. You'll need to
learn some SQL syntax for this.
3) Hook the two together.
4) Enjoy the satisfaction of "completing" your first project.
I've really simplified the tasks here - you'll have to get a web host that
gives you access to python (or host it yourself), learn how to work with
Python+HTML (it's not that difficult, but you'll be learning several
concepts at once which adds some to the complexity), learn the SQL language
in addition to Python... and whatever else happens to pop up.
The important thing is to be able to look at the problem and break it up
into chunks. If you ask yourself these two questions: "What do I need next?"
"What can I do *now* to accomplish that?" you'll find yourself moving
rapidly towards finishing your project. That's how I came up with those
tasks - "What do I need next?" "Well, I can't post a blog without somewhere
to enter the post." - so that's the first task. What's next? Well, I have to
have a way to save the blog posts. Ooh, a database is ideal for collecting
data so I can easily retrieve it. So I'll need to be able to connect to the
DB somehow.
Once you get more familiar with programming and concepts, you'll start to be
able to break problems up into much more manageable chunks, and you'll start
to see where you can logically break your programs up into different modules
and functions - pieces of code that you can reuse as part of a larger
program.
Anyhow, good luck, and HTH!
-Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100626/50337271/attachment.html>
More information about the Tutor
mailing list