Python Tutorial

Saturday, November 3, 2012

django hello world

Django is python high level framework. It always encourage rapid development and clean, pragmatic design. It lets you build high-performing, elegant web applications quickly. You can also develop back-end API(django have some cool library for it). Lets go....

Create a django project.

From command prompt:
Create django project: startproject django_hello_world
Create django app: python startapp hello

I am using pycharm, so I can create my project from pycharm.

Here I show you only which file I need to edit for run hello world project.
You can download full projcet from here



# set admin
    ('jony', ''),

#set database
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', 
        # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'dev.db',                      
        # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      
         # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      
        # Set to empty string for default. Not used with sqlite3.
    # Uncomment the next line to enable the admin:
    # 'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
    'hello', # need to install your app


# create a view function which we will call
from django.http import HttpResponse
def hello_view(request):
    return HttpResponse("Hello my django!!")

#call view from url
from hello import views
urlpatterns = patterns('',
    url(r'^hello_django/$', views.hello_view, name='my_hello_view'),

running project:

python syncbd 
# when you make chage on db, need to run this command
# create super user
python runserver 8080

Not hit this url:


Post a Comment