[SLL] Python/Django now, Apache and MySQL or PostgreSQL later [was: Perl and MySQL for LAMP]
Phil Mocek
pmocek-sll at mocek.org
Wed Jul 30 18:22:07 PDT 2008
On Wed, Jul 30, 2008 at 04:12:26PM -0700, Chuck Kranz wrote:
> I have had some experience with Perl but it appears PhP and Python are
> better. I'm inclined to go with Python. I haven't had any experience
> wit it yet. What do Ya'll think is best for LAMP?
There's not enough detail here to even guess at what's best. Go with
your inclination, and you'll be more likely to learn some good habits
without picking up so many bad ones. I like Perl for some purposes, and
I can't complain too much about PHP5. You won't go wrong with Python.
These are broad generalizations.
I suggest taking a look at Django. It's a Web application framework for
Python. I've been looking into Web app frameworks for PHP, Python, and
Ruby lately, and I'm quite impressed with Django. (I'd use Ruby on
Rails, but people haven't figured out how to make it scale up well yet,
and I need that option, so it's a dead-end for me.)
It has a built-in development server that will allow you to put off
installing and configuring Apache and pretty much avoid it altogether
except for on your production server. It works with MySQL, PostgreSQL,
or SQLite. By default, it uses SQLite, which allows you to put off
installing and configuring MySQL or PostgreSQL until you need to.
Putting off dealing with installation and configuration of the HTTP
server and DBMS will get you writing code and seeing results ASAP.
You'll get your feet wet right away and presumably get straight to the
fun parts. You can come back and get bogged down in software
installation drudgery later (not that it's *that* bad with a good
package management system like APT or RPM, but odds are that programming
is what you're really interested in). Once you have an application
written, it's a simple matter to run it on a different HTTP server
and/or with a different DBMS, and using the development server and
SQLite now with the intention of going heavier-duty later won't result
in any wasted time now, as the dev server and SQLite will work without
you having to touch them.
On a freshly-installed Debian or Ubuntu system, running "aptitude
install python-django" will get everything you need. Then, running
"django-admin startproject" will create a few files and directories for
you. Edit a few files, run "python manage.py runserver", point your Web
browser at port 8000 (i.e., browse to <http://localhost:8000/>) and
you'll see your application running.
Start with the The Django Book, which is available on the Web for free.
Chapter 1 is a nice introduction (including "what is a Web framework?"),
and you'll have a working Web app by the end of chapter 2. You can do
this in an hour, from installation to a functional "hello world" app.
The Django Book:
* <http://www.djangobook.com/>
Django home:
* <http://www.djangoproject.com/>
Django tutorials:
* <http://www-128.ibm.com/developerworks/library/l-django/index.html>
* <http://www.djangoproject.com/documentation/tutorial01/>
* <http://www.webmonkey.com/tutorial/Install_Django_and_Build_Your_First_App>
* <http://www.webmonkey.com/tutorial/Get_Started_With_Django>
Performance testing of Django and alternatives:
* <http://www.alrond.com/en/2007/jan/25/performance-test-of-6-leading-frameworks/>
--
Phil Mocek
More information about the linux-list
mailing list