特殊:Badtitle/NS100:Django:修订间差异
小无编辑摘要 |
|||
(未显示2个用户的2个中间版本) | |||
第2行: | 第2行: | ||
{{Languages|UbuntuHelp:Django}} | {{Languages|UbuntuHelp:Django}} | ||
=== Introduction === | === Introduction === | ||
Django is | 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 === | ||
==== Alternative to manual installation ==== | |||
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 | ||
第27行: | 第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的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/Django }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/af | • {{#if: UbuntuHelp:Django|Afrikaans| [[::Django/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/ar | • {{#if: UbuntuHelp:Django|العربية| [[::Django/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/az | • {{#if: UbuntuHelp:Django|azərbaycanca| [[::Django/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/bcc | • {{#if: UbuntuHelp:Django|جهلسری بلوچی| [[::Django/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/bg | • {{#if: UbuntuHelp:Django|български| [[::Django/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/br | • {{#if: UbuntuHelp:Django|brezhoneg| [[::Django/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/ca | • {{#if: UbuntuHelp:Django|català| [[::Django/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/cs | • {{#if: UbuntuHelp:Django|čeština| [[::Django/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/de | • {{#if: UbuntuHelp:Django|Deutsch| [[::Django/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/el | • {{#if: UbuntuHelp:Django|Ελληνικά| [[::Django/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/es | • {{#if: UbuntuHelp:Django|español| [[::Django/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/fa | • {{#if: UbuntuHelp:Django|فارسی| [[::Django/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/fi | • {{#if: UbuntuHelp:Django|suomi| [[::Django/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/fr | • {{#if: UbuntuHelp:Django|français| [[::Django/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/gu | • {{#if: UbuntuHelp:Django|ગુજરાતી| [[::Django/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/he | • {{#if: UbuntuHelp:Django|עברית| [[::Django/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/hu | • {{#if: UbuntuHelp:Django|magyar| [[::Django/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/id | • {{#if: UbuntuHelp:Django|Bahasa Indonesia| [[::Django/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/it | • {{#if: UbuntuHelp:Django|italiano| [[::Django/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/ja | • {{#if: UbuntuHelp:Django|日本語| [[::Django/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/ko | • {{#if: UbuntuHelp:Django|한국어| [[::Django/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/ksh | • {{#if: UbuntuHelp:Django|Ripoarisch| [[::Django/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/mr | • {{#if: UbuntuHelp:Django|मराठी| [[::Django/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/ms | • {{#if: UbuntuHelp:Django|Bahasa Melayu| [[::Django/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/nl | • {{#if: UbuntuHelp:Django|Nederlands| [[::Django/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/no | • {{#if: UbuntuHelp:Django|norsk| [[::Django/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/oc | • {{#if: UbuntuHelp:Django|occitan| [[::Django/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/pl | • {{#if: UbuntuHelp:Django|polski| [[::Django/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/pt | • {{#if: UbuntuHelp:Django|português| [[::Django/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/ro | • {{#if: UbuntuHelp:Django|română| [[::Django/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/ru | • {{#if: UbuntuHelp:Django|русский| [[::Django/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/si | • {{#if: UbuntuHelp:Django|සිංහල| [[::Django/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/sq | • {{#if: UbuntuHelp:Django|shqip| [[::Django/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/sr | • {{#if: UbuntuHelp:Django|српски / srpski| [[::Django/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/sv | • {{#if: UbuntuHelp:Django|svenska| [[::Django/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/th | • {{#if: UbuntuHelp:Django|ไทย| [[::Django/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/tr | • {{#if: UbuntuHelp:Django|Türkçe| [[::Django/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/vi | • {{#if: UbuntuHelp:Django|Tiếng Việt| [[::Django/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/yue | • {{#if: UbuntuHelp:Django|粵語| [[::Django/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/zh | • {{#if: UbuntuHelp:Django|中文| [[::Django/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/zh-hans | • {{#if: UbuntuHelp:Django|中文(简体)| [[::Django/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Django | UbuntuHelp:Django | {{#if: | :}}Django}}/zh-hant | • {{#if: UbuntuHelp:Django|中文(繁體)| [[::Django/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:Django|:Django|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#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.