Advertisment

Tips to enhance your websites using Django!

author-image
CIOL Bureau
Updated On
New Update

Tips to enhance your websites using Django!Sufyan bin Uzayr

Advertisment

BANGALORE, INDIA: Django is a free, open source framework based on Python that can be used to develop websites and define complex data structures. In Django, applications consist of separate models (description of data), views (generation of data to be displayed) and templates (visual appearance). Further more, you can easily define model classes for your data. Once your app has been setup, an admin panel is created out of the box and you can customize it at leisure.

Installation

If you are using Linux, chances are you already have Python installed. If not, you can get it from your distro's repositories. For instance, Ubuntu users can use:

Advertisment

sudo apt-get install python-django

If you are using Windows, you can download Python from the website www.python.org/download. Once extracted, you will need to point to the folder before proceeding.

Next, head to www.djangoproject.com and download the archive. Django is licensed under a BSD license and comes with an in-built SQLite database and so if you do not have a production environment, you can still experiment with it.

Advertisment

Implementation

Now that we have installed Django, let us create a simple application that lets you keep a log of your transactions. In order to create such an app, we need to store a list of funds and expenditure, and then associate a given amount of money with a particular expenditure as and when needed. Naturally, both 'funds' and 'expenditure' shall have their own associated sub-fields.

Creating the site

Advertisment

First, use the command line to navigate to the folder where you wish to keep this project and then type:

python django-admin.py startproject pcqname

This will create the website's basic structure within the folder 'pcqname'. Now, navigate to that folder ('pcqname'). Note, however, that Windows users might need to pass the absolute path the django-admin.py with C:\Python27\Scripts\django-admin.py.

Click here to continue reading!

(The author is Freelance Writer, Graphic Artist and Photographer)

tech-news