#date:2017.07.19 django app, Part 2

Writing your first django app, part 2

this tutorial begins where Tutorial 1 left off.We'll setup the database, create your first model, and get a quick introduction to Django's automatically-generated admin site.
這篇教程從教程1,咱們會配置本身的數據庫,創造你的第一個模型,開始一個快捷的django自動生成管理員站點。mysql

database setup

if you wish yo use another databse install the approprite database bindings ans change the following keys in DATABASE 'default itemto match your database connection setting:web

ENGINE : django.db.backends.mysqlsql

NAME : The name of your database.數據庫

The migrate command looks at the INSTALLED_APPS setting and creates any nessary database tables according to the database setings in your mysite/settings.py fiel and database migrations shipped with the app. You'll see a message for each migration it applies. If you're interested, run the commadn-line client for your database ans typedjango

migrate查看INSTALLED_APPS設置並根據這個mysite/setting.py文件中的數據庫設置建立任何須要的數據庫表,數據庫的遷移還會跟蹤應用的變化app

minimalists : 極簡主義者網站

a model is a single, definitive source of truth about your data.It contains the essential fields ans behaviors of the data you're storing.ui

項目和應用之間有什麼不一樣呢,應用是一個web應用程序,他完成具體的事項,好比一個博客系統一個存儲工做檔案的數據庫或者一個簡單的頭片應用。項目是一個特性網站的相關配置和應用的集合。一個項目能夠包含多個應用。一個應用能夠應用到多個項目中去。this

相關文章
相關標籤/搜索