Python language uses Django to develop web frameworks

Source: Internet
Author: User
Tags install django git clone

Introduction to the Django Web framework

The Django project is a python[1] custom framework that originated in an online news web site and was released in 2005 as an Open-source form. The core components of the Django framework are:

The object-relational mapping used to create the model is the perfect management interface designed for end users the first class URL design designer-friendly template language caching system. Django conforms to MTV architecture

Django Installation

There are two ways to install Django, specifically refer to the official website (https://www.djangoproject.com/download/), which uses the second method, option 2. Get the latest development version, specifically as follows:

[Dw_mon@tddba ~]$ git clone https://github.com/django/django.git  
[dw_mon@tddba install]$ cd Django  
[Dw_ MON@TDDBA django]$ python setup.py install

Once the installation is successful, you can use the Django Administration tool django-admin.py

Django Projects and Applications

Create a Django project with the following command:

[Dw_mon@tddba project]$ django-admin.py startproject eshop

The above command creates a eshop folder (that is, a project) under the current directory that contains the basic configuration files needed to run the Django project:

[Dw_mon@tddba eshop]$ ls  
__init__.py  settings.py  urls.py  wsgi.py

Next, we will create an application order under this project:

[Dw_mon@tddba eshop]$ python manage.py startapp order

The above command creates an order directory under the current directory, which has the following files:

[Dw_mon@tddba eshop]$ CD order  
[dw_mon@tddba products]$ ls  
admin.py  __init__.py  tests.py  views.py

Providing the location of an application in a project is simply a custom established for new Django developers and is not required.
To enable Django to recognize the existence of a new application, you also need to add an entry to the Installed_apps in the settings.py file:

Installed_apps = (  
    ' django.contrib.admin ',  
    ' Django.contrib.auth ', '  
    django.contrib.contenttypes ',  
    ' django.contrib.sessions ',  
    ' django.contrib.messages ', '  
    django.contrib.staticfiles  
    ', ' Order ',  
)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.