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

来自Ubuntu中文
跳到导航跳到搜索
Wikibot留言 | 贡献
新页面: {{From|https://help.ubuntu.com/community/Django}} {{Languages|UbuntuHelp:Django}} === Introduction === Django is a high-level Python Web framework that encourages rapid development and cl...
 
 
(未显示2个用户的3个中间版本)
第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 is 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.
Also see http://www.djangobook.com/
Also see http://www.djangobook.com/
=== Installation ===
=== Installation ===
==== Quick shortcut ====
==== Alternative to manual installation ====
If you would rather not setup the Django framework by hand, then one of the easiest ways to get up and running with Django is the [http://www.turnkeylinux.org/appliances/django   TurnKey Django ] installable live CD appliance, which is based on Ubuntu 8.04.1 (Hardy).
Some users may prefer to skip manual installation by using the unofficial pre-integrated [http://www.turnkeylinux.org/django TurnKey Django Appliance] based on Ubuntu LTS.
==== Installing on Apache using mod_python ====
==== Installing on Apache using mod_python ====
Install Ubuntu-Server
Install Ubuntu-Server
第29行: 第30行:
sudo a2ensite django-example
sudo a2ensite django-example
sudo /etc/init.d/apache2 reload</nowiki></pre>
sudo /etc/init.d/apache2 reload</nowiki></pre>
Hit the box with a browser, and you should see "Django examples" and some links.
Hit the box with a browser, and you should see "Django examples" and some links.


[[category:UbuntuHelp]]
[[category:UbuntuHelp]]

2014年4月8日 (二) 01:26的最新版本

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

Introduction

Django is 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.