Django 官方教程翻译项目/var/www)。但使用 Django 时你不用这样做。而且把所有 Python 代码放在 Web 服务器的根目录不是个好主意,因为这样会 有风险。比如人们可能会在网站上看到你的代码。这不利于网站的安全。 你可以把代码放在文档根目录 以外 的地方,比如 /home/mycode。 让我们看看 startproject 这命令创建了什么: 1. mysite/ 2. manage.py CREATE TABLE "polls_choice" ( 6. "id" serial NOT NULL PRIMARY KEY, 7. "choice_text" varchar(200) NOT NULL, 8. "votes" integer NOT NULL 9. ); 10. -- 11. -- 创建 Question 模型 12. -- 13. CREATE "polls_question" ( 14. "id" serial NOT NULL PRIMARY KEY, 15. "question_text" varchar(200) NOT NULL, 16. "pub_date" timestamp with time zone NOT NULL 17. ); 18. -- 19. -- 对 choice 表添加 question0 码力 | 103 页 | 1.86 MB | 1 年前3
Django、Vue 和Element UI 前后端原理论述函数的视图和基于类的视图,还有通用视图和视图集等。 路由:DRF 提供了灵活的路由功能,用于将 API 请求映射到相应的视图处理函数上。 认证和权限:DRF 支持各种认证和权限控制方式,可以保护 API 的安全性。 分页和过滤:DRF 提供了分页和过滤功能,便于处理大量数据和筛选查询结果。 强大的请求和响应处理:DRF 支持各种数据格式的请求和响应处理,包括 JSON、 XML、HTML 等。 API www.51testing.com 1)代码生成:生成代码、构建单元测试、创建代码注释、解释新代码以及检查安全 漏洞; 2)兼容性:适用于 AppCode、GoLand、IntelliJ、PyCharm、PhpStorm、Rider、RubyMine 和 WebStorm; 3)隐私和安全:优先考虑用户隐私,从不存储或复制代码,始终对数据和日志进行 加密。 除此之外呢?它还可以生成测试用 IntelliJ 为例,简要说明安装方法。 点击 file>settings>plugins,搜索“Bito”,安装即可。十分简单、方便,不是?! ·使用方法 Bito 支持代码解释、生成注释、性能检查、安全检查、风格检查、可读性提升、单 元测试用例生成,以及自定义 prompt 等功能,如下图所示。 10 《51 测试天地》七十四 www.51testing.com 如何使用呢? 1) 以“代码解释”为例0 码力 | 61 页 | 6.84 MB | 1 年前3
Django 4.2.x Documentation"polls_question" ( "id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "question_text" varchar(200) NOT NULL, "pub_date" timestamp with time zone NOT NULL ); -- -- Create model Choice ( "id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "choice_text" varchar(200) NOT NULL, "votes" integer NOT NULL, "question_id" bigint NOT NULL ); ALTER TABLE "polls_choice" py b/tests/shortcuts/test_make_toast.py new file mode 100644 index 0000000000..6f4c627b6e --- /dev/null +++ b/tests/shortcuts/test_make_toast.py @@ -0,0 +1,7 @@ +from django.shortcuts import make_toast0 码力 | 3305 页 | 3.16 MB | 1 年前3
Django 4.1.x Documentation"polls_question" ( "id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "question_text" varchar(200) NOT NULL, "pub_date" timestamp with time zone NOT NULL ); -- -- Create model Choice ( "id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "choice_text" varchar(200) NOT NULL, "votes" integer NOT NULL, "question_id" bigint NOT NULL ); ALTER TABLE "polls_choice" py b/tests/shortcuts/test_make_toast.py new file mode 100644 index 0000000000..6f4c627b6e --- /dev/null +++ b/tests/shortcuts/test_make_toast.py @@ -0,0 +1,7 @@ +from django.shortcuts import make_toast0 码力 | 3240 页 | 3.13 MB | 1 年前3
Django 4.0.x Documentationserial NOT NULL PRIMARY KEY, "question_text" varchar(200) NOT NULL, "pub_date" timestamp with time zone NOT NULL ); -- -- Create model Choice -- CREATE TABLE "polls_choice" ( "id" serial NOT NULL PRIMARY PRIMARY KEY, "choice_text" varchar(200) NOT NULL, "votes" integer NOT NULL, "question_id" integer NOT NULL ); ALTER TABLE "polls_choice" ADD CONSTRAINT "polls_choice_question_id_c5b4b260_fk_polls_question_id" py b/tests/shortcuts/test_make_toast.py new file mode 100644 index 0000000000..6f4c627b6e --- /dev/null +++ b/tests/shortcuts/test_make_toast.py @@ -0,0 +1,7 @@ +from django.shortcuts import make_toast0 码力 | 2248 页 | 7.90 MB | 1 年前3
Django 4.0.x DocumentationTABLE "polls_question" ( "id" serial NOT NULL PRIMARY KEY, "question_text" varchar(200) NOT NULL, "pub_date" timestamp with time zone NOT NULL ); -- -- Create model Choice -- CREATE TABLE "polls_choice" "polls_choice" ( "id" serial NOT NULL PRIMARY KEY, "choice_text" varchar(200) NOT NULL, "votes" integer NOT NULL, "question_id" integer NOT NULL ); ALTER TABLE "polls_choice" ADD CONSTRAINT py b/tests/shortcuts/test_make_toast.py new file mode 100644 index 0000000000..6f4c627b6e --- /dev/null +++ b/tests/shortcuts/test_make_toast.py @@ -0,0 +1,7 @@ +from django.shortcuts import make_toast0 码力 | 3184 页 | 3.14 MB | 1 年前3
Django 2.2.x Documentationserial NOT NULL PRIMARY KEY, "choice_text" varchar(200) NOT NULL, "votes" integer NOT NULL ); -- -- Create model Question -- CREATE TABLE "polls_question" ( "id" serial NOT NULL PRIMARY KEY "question_text" varchar(200) NOT NULL, "pub_date" timestamp with time zone NOT NULL ); -- -- Add field question to choice -- ALTER TABLE "polls_choice" ADD COLUMN "question_id" integer NOT NULL; ALTER TABLE "polls_choice" py b/tests/shortcuts/test_make_toast.py new file mode 100644 index 0000000000..6f4c627b6e --- /dev/null +++ b/tests/shortcuts/test_make_toast.py @@ -0,0 +1,7 @@ +from django.shortcuts import make_toast0 码力 | 2915 页 | 2.83 MB | 1 年前3
Django 2.1.x Documentation"id" serial NOT NULL PRIMARY KEY, "choice_text" varchar(200) NOT NULL, "votes" integer NOT NULL ); -- -- Create model Question -- CREATE TABLE "polls_question" ( "id" serial NOT NULL PRIMARY KEY, "question_text" "question_text" varchar(200) NOT NULL, "pub_date" timestamp with time zone NOT NULL ); (continues on next page) 22 Chapter 2. Getting started Django Documentation, Release 2.1.16.dev20191202082911 (continued -- Add field question to choice -- ALTER TABLE "polls_choice" ADD COLUMN "question_id" integer NOT NULL; ALTER TABLE "polls_choice" ALTER COLUMN "question_id" DROP DEFAULT; CREATE INDEX "polls_choice_7aa0f6ee"0 码力 | 1910 页 | 6.49 MB | 1 年前3
Django 2.1.x Documentationserial NOT NULL PRIMARY KEY, "choice_text" varchar(200) NOT NULL, "votes" integer NOT NULL ); -- -- Create model Question -- CREATE TABLE "polls_question" ( "id" serial NOT NULL PRIMARY KEY "question_text" varchar(200) NOT NULL, "pub_date" timestamp with time zone NOT NULL ); -- -- Add field question to choice -- ALTER TABLE "polls_choice" ADD COLUMN "question_id" integer NOT NULL; ALTER TABLE "polls_choice" py b/tests/shortcuts/test_make_toast.py new file mode 100644 index 0000000000..6f4c627b6e --- /dev/null +++ b/tests/shortcuts/test_make_toast.py @@ -0,0 +1,7 @@ +from django.shortcuts import make_toast0 码力 | 2790 页 | 2.71 MB | 1 年前3
Django 3.1.x DocumentationCREATE TABLE "polls_question" ( "id" serial NOT NULL PRIMARY KEY, "question_text" varchar(200) NOT NULL, "pub_date" timestamp with time zone NOT NULL ); -- (continues on next page) 22 Chapter 2. Getting CREATE TABLE "polls_choice" ( "id" serial NOT NULL PRIMARY KEY, "choice_text" varchar(200) NOT NULL, "votes" integer NOT NULL, "question_id" integer NOT NULL ); ALTER TABLE "polls_choice" ADD CONSTRAINT py b/tests/shortcuts/test_make_toast.py new file mode 100644 index 0000000000..6f4c627b6e --- /dev/null +++ b/tests/shortcuts/test_make_toast.py @@ -0,0 +1,7 @@ +from django.shortcuts import make_toast0 码力 | 2053 页 | 6.92 MB | 1 年前3
共 55 条
- 1
- 2
- 3
- 4
- 5
- 6













