特殊:Badtitle/NS100:Django:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Wikibot留言 | 贡献
无编辑摘要
第2行: 第2行:
{{Languages|UbuntuHelp:Django}}
{{Languages|UbuntuHelp:Django}}
=== Introduction ===
=== Introduction ===
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Python's equivalent to the famous Ruby on rails, Django lets you build high-performing, elegant Web applications quickly. Django focuses on automating as much as possible and adhering to the "Don't Repeat Yourself" (DRY) principle.
Django a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Python's equivalent to the famous Ruby on rails, Django lets you build high-performing, elegant Web applications quickly. Django focuses on automating as much as possible and adhering to the "Don't Repeat Yourself" (DRY) principle.
It can be found at http://www.djangoproject.com/.
It can be found at http://www.djangoproject.com/.
=== How it works ===
=== How it works ===
In Django, first you define your database models, which generate SQL for the database and allow Django to know about the data. This is essential for the DRY (don't repeat yourself) concept. Next, the views are defined, this is where any business logic, interactions with the database and the like go. Then, the URLs are defined as regular expression the map to views. Finally, templates are written, which are html (or anything composed of text) with data and simple data control sprinkled throughout.
In Django, first you define your database models, which generate SQL for the database and allow Django to know about the data. This is essential for the DRY (don't repeat yourself) concept. Next, the views are defined, this is where any business logic, interactions with the database and the like go. Then, the URLs are defined as regular expression the map to views. Finally, templates are written, which are html (or anything composed of text) with data and simple data control sprinkled throughout.

2014年4月8日 (二) 01:24的版本

{{#ifexist: :Django/zh | | {{#ifexist: Django/zh | | {{#ifeq: {{#titleparts:Django|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Django|1|-1|}} | zh | | }}

Introduction

Django a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Python's equivalent to the famous Ruby on rails, Django lets you build high-performing, elegant Web applications quickly. Django focuses on automating as much as possible and adhering to the "Don't Repeat Yourself" (DRY) principle. It can be found at http://www.djangoproject.com/.

How it works

In Django, first you define your database models, which generate SQL for the database and allow Django to know about the data. This is essential for the DRY (don't repeat yourself) concept. Next, the views are defined, this is where any business logic, interactions with the database and the like go. Then, the URLs are defined as regular expression the map to views. Finally, templates are written, which are html (or anything composed of text) with data and simple data control sprinkled throughout. Also see http://www.djangobook.com/

Installation

Alternative to manual installation

Some users may prefer to skip manual installation by using the unofficial pre-integrated TurnKey Django Appliance based on Ubuntu LTS.

Installing on Apache using mod_python

Install Ubuntu-Server

sudo apt-get install libapache2-mod-python python-django
sudo vim /etc/apache2/sites-available/django-example
<Location "/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    PythonDebug On
    PythonPath "['/usr/share/doc/python-django'] + sys.path"
    SetEnv DJANGO_SETTINGS_MODULE examples.settings
</Location>
sudo a2dissite default
sudo a2ensite django-example
sudo /etc/init.d/apache2 reload

Hit the box with a browser, and you should see "Django examples" and some links.