I'v made a easiest and simplest tutorial, just want the study work can
be from scratch but not a big one, I hope this will be helpful. This
tutorial will only aim to create a "Hello, django!" page, there will
be no more things except it. So there is almost nothings in it, but it
can be run in django.

1. setup the django (just python setup.py install)

2. django-admin.py startproject newtest
then goto newtest directory

3. modify settings.py
I won't want to change it, but if I just start the web server, there
will raise a execption show that I didn't config the database options.
So I had to change the settings.py, just these lines:

DATABASE_ENGINE = 'sqlite3'

But I'll not use them in this tutorial. And make sure you have
pysqlite2 module installed. If this one can be skipped, this tutorial
will be easier.

4. create a helloworld.py file in newtest directory
the content of the file is:

    from django.utils.httpwrappers import HttpResponse

    def index(request):
        return HttpResponse("Hello, django.")

5. modify urls.py

urlpatterns = patterns('',
    # Example:
    (r'^$', 'helloworld.index'),

    # Uncomment this for admin:
#     (r'^admin/', include('django.contrib.admin.urls.admin')),
)

I map the null to 'helloworld.index'

6. start the web server

manage.py runserver

7. view the result

You will see the "Hello, django!" in the browser.

That's the all. The only thing I used just is urldispatcher.

I hope it will be fun for beginners.
--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

Reply via email to