谈一下感想
大部分时间花在配置环境上了,很痛苦、很麻烦,自己的linux水平太低了,许多东西都不太理解,仅仅是照着文档来安装,一旦出了一点问题,连变通的办法都没有 。
笔记
Writing your first Django app, part 1
-----------------------------------------
Creating a project
django-admin.py startproject mysite
The development server
Database setup
这部分真够麻烦,我安装mysql遇到了好多问题呢,Linux要好好学习才行。问题详见blog。
运行python manage.py syncdb
后,我建立了一个超级帐户,用户名develop,密码develop
以下是自动建立的表
mysql> show tables;
+----------------------------+
| Tables_in_mysite |
+----------------------------+
| auth_group |
| auth_group_permissions |
| auth_message |
| auth_permission |
| auth_user |
| auth_user_groups |
| auth_user_user_permissions |
| django_content_type |
| django_session |
| django_site |
+----------------------------+
10 rows in set (0.01 sec)
以上的工作完成后,所有的“project”环境就已经搭建完成
Creating models
"project"与"app"的关系
Projects vs. apps
What's the difference between a project and an app? An app is a Web
application that does something -- e.g., a weblog system, a database of
public records or a simple poll app. A project is a collection of
configuration and apps for a particular Web site. A project can contain
multiple apps. An app can be in multiple projects.
To create your app, make sure you're in the mysite directory and type
this command:
python manage.py startapp polls
That'll create a directory polls, which is laid out like this:
polls/
__init__.py
models.py
views.py
This directory structure will house the poll application.
In our simple poll app, we'll create two models: polls and choices
Activating models
That small bit of model code gives Django a lot of information. With it,
Django is able to:
Create a database schema (CREATE TABLE statements) for this app.
Create a Python database-access API for accessing Poll and Choice
objects
Playing with the API
python manage.py shell
We're using this instead of simply typing "python", because manage.py sets up the project's environment for you.
分享到:
相关推荐
Writing your first Django app
django笔记 django笔记
django教程:基本操作笔记整理.png
Django学习笔记.pdf
django学习笔记django学习笔记django学习笔记
Django2非常好的入门教程,讲解清晰明白,内容详实,分享给大家
Django在线教育平台开发笔记_DnZWvpg1
学习django框架的笔记,超详细
学习Django框架不二选择,有源码有笔记(思维导图)
一起学习django,希望对你有帮助
在看django book 2.0和django官方文档的过程中自己做的django笔记,
Beginning Django Web App Dev with Python Beginning Django Web App Dev with Python
2022 B站最详细django3教程(django从入门到实践) 很适合刚学习django的同学 通过一个案例,把django的基本的templates,models,urls,from,modelfrom讲的清清楚楚,甚至还给了我们应用场景。
Django restframework课件笔记详解,对Django restframework各功能模块的介绍以及真实案例分析。
学习python的总结,适合借鉴,有python代码,Django的详细流程
django学习笔记,包含安装、setting详解 admin自定义管理、数据类型、视图、restfromework、认证权限等
千锋Django笔记.rar
django学习
个人总结的Django学习笔记, 持续更新中。 目前只是总结了django的一部分学习逻辑。