摘要: """ 斐波那契数列(Fibonacci sequence),又称黄金分割数列,指的是这样一个数列:0、1、1、2、3、5、8、13、21、34 在数学上,费波那契数列是以递归的方法来定义: F0 = 0 (n=0) F1 = 1 (n=1) Fn = F[n-1]+ F[n-2](n=>2) "" 阅读全文
posted @ 2024-09-21 09:55 人要靠自己you 阅读(142) 评论(0) 推荐(0)
摘要: 自动化测试 开始第一个测试 首先有一个bug python3 manage.py shell 创建一个测试来暴露这个 bug 将下面的代码写入 polls 应用里的 tests.py 文件内 点击查看代码 from django.test import TestCase # Create your 阅读全文
posted @ 2023-08-25 10:12 人要靠自己you 阅读(9) 评论(0) 推荐(0)
摘要: 写一个最小的表单 编辑 detail.html 点击查看代码 <form action="{% url 'polls:vote' question.id%}" method="post"> {% csrf_token %} <fieldset> <legend><h1>{{ question.que 阅读全文
posted @ 2023-07-01 16:07 人要靠自己you 阅读(25) 评论(0) 推荐(0)
摘要: 编写更多的视图 编辑polls/views.py 点击查看代码 from django.shortcuts import render from django.http import HttpResponse # Create your views here. def index(request): 阅读全文
posted @ 2023-07-01 15:23 人要靠自己you 阅读(33) 评论(0) 推荐(0)
摘要: 数据库设置 open mysite/settings.py Database Setup 点击查看代码 ''' 这里的数据需要提前创建,否则就回报错:(1049, "Unknown database 'polls'") ''' import pymysql pymysql.install_as_My 阅读全文
posted @ 2023-06-30 19:02 人要靠自己you 阅读(20) 评论(0) 推荐(0)
摘要: 创建project 查看Django版本 python3 -m django --version 如果没有安装则安装django pip3 install django -i https://pypi.tuna.tsinghua.edu.cn/simple/ 进入你想要保存代码的文件夹下创建项目 d 阅读全文
posted @ 2023-06-30 17:55 人要靠自己you 阅读(23) 评论(0) 推荐(0)