Learn Django

Today I start the learning of django Framework.

There is simple instructions for creating the application in Django .

  • django-admin.py startproject __NAME OF PROJECT__

Now you see some files in this folder like:- manage.py

  • django-admin.py startapp __NAME OF APP__

Now You some file in your application folder. like:module.py, admin.py etc.

Now go in your project folder 

  • cd projectname/

Then run this command 

  • python manage.php  migration                                                //For migrate with database

Now Start the coding of application (i make simple signup application)

open you module.py file in application folder


from django.db import models
from django.utils.encoding import smart_unicode

class SignUp(models.Model):
first_name = models.CharField(max_length=120,null=True,blank=True)

def __unicode__(self):
return smart_unicode(self.first_name)

 Now Start the coding of Admin panel. With help of this your application is easy to add in django control panel.


from django.contrib import admin

from .models import SignUp

class SignUpAdmin(admin.ModelAdmin):
class Meta:


How to run this application follow this simple instructions 

  1. cd project name
  2. python manage.py createsuperuser                                                  //enter the superuser name and password
  3. python manage.py syncdb                                                              //create new table

Set up Your application in django so update settings.py file

settings.py file in your application folder

cd /project_name/project_name/

vim settings.py

Set up your database

'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'he',

  Set up your application 

'your application name', 

Now run these commands to your project 

Go in your project folder


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s