├── README.md ├── addesss.md ├── articles.md ├── books.md ├── devops.md ├── django.md ├── django_examples └── django_school │ ├── README.md │ ├── classroom │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── decorators.py │ ├── fixtures │ │ ├── datas.json │ │ └── quizzes.json │ ├── forms.py │ ├── functional_tests.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_auditentry.py │ │ └── __init__.py │ ├── models.py │ ├── signals.py │ ├── templates │ │ └── classroom │ │ │ ├── _guest_header.html │ │ │ ├── about.html │ │ │ ├── quiz_list.html │ │ │ ├── students │ │ │ ├── _header.html │ │ │ ├── interests_form.html │ │ │ ├── quiz_list.html │ │ │ ├── quiz_result.html │ │ │ ├── student_detail.html │ │ │ ├── student_list.html │ │ │ ├── take_quiz_form.html │ │ │ └── taken_quiz_list.html │ │ │ └── teachers │ │ │ ├── question_add_form.html │ │ │ ├── question_change_form.html │ │ │ ├── question_delete_confirm.html │ │ │ ├── question_preview.html │ │ │ ├── quiz_add_form.html │ │ │ ├── quiz_change_form.html │ │ │ ├── quiz_change_list.html │ │ │ ├── quiz_delete_confirm.html │ │ │ └── quiz_results.html │ ├── templatetags │ │ ├── __init__.py │ │ └── quiz_extras.py │ ├── tests.py │ ├── urls.py │ └── views │ │ ├── __init__.py │ │ ├── classroom.py │ │ ├── students.py │ │ └── teachers.py │ ├── manage.py │ ├── mysite │ ├── __init__.py │ ├── asgi.py │ ├── humans.txt │ ├── settings.py │ ├── static │ │ ├── css │ │ │ ├── app.css │ │ │ ├── bootstrap.min.css │ │ │ ├── students.css │ │ │ └── teachers.css │ │ ├── datatables │ │ │ ├── dataTables.bootstrap4.min.css │ │ │ ├── dataTables.bootstrap4.min.js │ │ │ └── jquery.dataTables.min.js │ │ ├── img │ │ │ ├── favicon.ico │ │ │ └── favicon.png │ │ ├── js │ │ │ └── jquery-3.3.1.min.js │ │ └── vendor │ │ │ └── fontello-2f186091 │ │ │ ├── LICENSE.txt │ │ │ ├── README.txt │ │ │ ├── config.json │ │ │ ├── css │ │ │ ├── animation.css │ │ │ ├── fontello-codes.css │ │ │ ├── fontello-embedded.css │ │ │ ├── fontello-ie7-codes.css │ │ │ ├── fontello-ie7.css │ │ │ └── fontello.css │ │ │ ├── demo.html │ │ │ └── font │ │ │ ├── fontello.eot │ │ │ ├── fontello.svg │ │ │ ├── fontello.ttf │ │ │ ├── fontello.woff │ │ │ └── fontello.woff2 │ ├── templates │ │ ├── 404.html │ │ ├── 500.html │ │ ├── base.html │ │ └── registration │ │ │ ├── login.html │ │ │ └── signup_form.html │ ├── urls.py │ └── wsgi.py │ └── requirements.txt ├── fastapi.md ├── flask.md ├── libraries.md ├── other_books.md ├── python_good_books.md ├── society_books.md ├── testing.md ├── tips.md ├── videos.md ├── zhongyi.md └── 知名公司面试题.md /addesss.md: -------------------------------------------------------------------------------- 1 | * [国学 中医 历史等社科类书籍下载](https://github.com/china-testing/python-api-tesing/blob/master/society_books.md) 2 | * [电影 视频 下载](https://github.com/china-testing/python-api-tesing/blob/master/videos.md) 3 | * [IT类书籍 下载](https://github.com/china-testing/python-api-tesing/blob/master/books.md) 4 | 5 | 6 | | 类别 | 名称 | 名称 | 名称 | 名称 | 名称 | 名称 7 | | --- | --- | --- | --- | --- | --- | --- | 8 | **常用** | [oscobo](https://www.oscobo.com/) | [谷歌](https://www.google.com.hk/?gws_rd=ssl) |[谷歌翻译](http://translate.google.cn/?hl=zh-CN) |[360百科](https://baike.so.com/doc/1790119-1892991.html) | [维基中文](https://zh.wikipedia.org/wiki/Python) | [deepl](https://www.deepl.com/translator) 9 | |-| [必应](https://cn.bing.com/search?q=site%3Achina-testing.github.io&qs=n&form=QBLH&sp=-1&pq=site%3Achina-testing.github.io&sc=0-26&sk=&cvid=CF01D3E7586D46EDA7A260FAD61344CD) | [代码搜索](https://searchcode.com/)| [有道词典](http://dict.youdao.com/) | [百度百科](https://baike.baidu.com/item/Python/407313) | [overflow](http://stackoverflow.com/) | [歌曲宝](https://www.gequbao.com/s/MP3%E6%AD%8C%E6%9B%B2) 10 | |- | [百度](https://www.baidu.com/) |[so](https://www.so.com/s?ie=utf-8&fr=none&src=360sou_newhome&q=site%3Achina-testing.github.io)|[bing翻译](https://cn.bing.com/Translator) |[知乎](https://www.zhihu.com/) | [维基英文](https://en.wikipedia.org/wiki/Python_(programming_language)) | [空气污染](http://aqicn.org/map/hk/#@g/24.0686/113.7764/7z) | 11 | |**技术**| [新浪科技](https://tech.sina.com.cn/) | [guru99](https://www.guru99.com/) |[vogella](https://www.vogella.com/tutorials/) | [annas-archive](https://zh.annas-archive.org/) | [z-library](https://zh.z-lib.gs/) | [z-library_tor](http://zlibrary24tuxziyiyfr7zd46ytefdqbqd2axkmxm4o5374ptpc52fad.onion/) 12 | |**Python** | [pypi](https://pypi.python.org/pypi) | [pymotw](https://pymotw.com) | [effbot](http://effbot.org/librarybook/) |[python库](https://github.com/china-testing/python-api-tesing) | [awesome-python](https://github.com/vinta/awesome-python) | [jobbole](http://python.jobbole.com/) | 13 | | Python | [memect](http://memect.com/) | [wiki](https://wiki.python.org/moin/Documentation) | [pythonjobs](http://pythonjobs.github.io/) | [标准库](https://docs.python.org/3/library/) | [python中文](https://docs.python.org/zh-cn/3/) | [自动化库汇总](https://github.com/atinfo/awesome-test-automation/blob/master/python-test-automation.md#rest-api-testing) | 14 | | |[realpython](https://realpython.com/) |[pbpython_pd](https://pbpython.com/) |[quizzes](https://realpython.com/quizzes/) |[marsja](https://www.marsja.se/category/programming/python/) |[清华pypi](https://mirrors.tuna.tsinghua.edu.cn/help/pypi/) 15 | | 每日新闻 | [美国之音](http://www.voachinese.com/) | [联合早报](http://www.zaobao.com/) | [天气预报](http://www.weather.com.cn/weather/101280601.shtml) | [ft中文](http://www.ftchinese.com/) | [华尔街](http://cn.wsj.com/gb/index.asp) | [路透社](http://cn.reuters.com) 16 | | pandas | [listendata](https://www.listendata.com/search/label/Python) |[mc.ai](https://mc.ai/) |[cnet](http://www.sznews.com/news/node_18235.htm)  | 17 | | 排名 | [编程流行度](http://pypl.github.io/PYPL.html) | [TIOBE](http://www.tiobe.com/tiobe-index/) | [数据库排名](http://db-engines.com/en/ranking) | [IEEE](http://spectrum.ieee.org/computing/software/the-2016-top-programming-languages) | [codeevalblog](http://blog.codeeval.com/codeevalblog) | [redmonk](http://redmonk.com/sogrady/category/programming-languages/) | 18 | | 测试 | [谷歌测试博客](https://testing.googleblog.com/) | [webpagetest](https://www.webpagetest.org/) |[testandcode](https://testandcode.com) | [WAVE Web Accessibility](https://wave.webaim.org/) |[practitest](https://www.practitest.com/resource-center/) | 19 | | 调优 |[hpcwire](https://www.hpcwire.com/) | [webpagetest](https://www.webpagetest.org/) |[testandcode](https://testandcode.com) | [WAVE Web Accessibility](https://wave.webaim.org/) |[practitest](https://www.practitest.com/resource-center/) | 20 | | 武冈 | [红网论坛](http://bbs.rednet.cn/forum.php?mod=forumdisplay&fid=74) | [百度武冈](http://news.baidu.com/ns?word=%CE%E4%B8%D4&tn=news&from=news&cl=2&rn=20&ct=0) | [武冈政府](http://www.wugang.gov.cn/) | [武冈天气](http://www.weather.com.cn/weather/101250908.shtml) | | 21 | | 标准论文 | [国家标准](https://std.samr.gov.cn/gb/gbQuery) | [标准网](https://www.biaozhun.org/) | [标准下载](https://www.bzxz.net/) | [HAL](https://hal.science/search/index/?q=slurm&rows=30&language_s=en) | | 22 | | 英语 | [给力6a1](https://www.geilien.cn/ebooks/xiangnu/6a/lesson1.html) | [给力4a1](https://www.geilien.cn/ebooks/xiangnu/4a/lesson1.html) | 23 | | 转换 | [mp4-to-gif](https://cloudconvert.com/mp4-to-gif) | | 24 | | 书籍 | [z-lib](https://zh.z-lib.gs/) | [archive](https://archive.org/details/texts) | [DigiLibraries](http://digilibraries.com/) | [安娜档案](https://tw.annas-archive.org/) | 25 | | 书籍 | [coderprog](https://coderprog.com/) | [finelybook](http://finelybook.com/) | [pansoso](http://www.pansoso.com/) | [wowebook](http://www.wowebook.org/) | []() | []() | 26 | | CAE | [theartofhpc](https://theartofhpc.com/) | [Introduction to Parallel Computing Tutorial](https://hpc.llnl.gov/documentation/tutorials/introduction-parallel-computing-tutorial) | [pansoso](http://www.pansoso.com/) | [wowebook](http://www.wowebook.org/) | [numdiff](https://www.nongnu.org/numdiff/numdiff.html) | []() | 27 | | 工具 | [Git-Cheat-Sheet](https://github.com/flyhigher139/Git-Cheat-Sheet) | [web酷狗](http://web.kugou.com/) | [网站排行](http://top.chinaz.com/) | [去水印](https://www.watermarkremover.io/zh/upload) | [processon在线绘图](https://www.processon.com/) 28 | | 地图 | [earth地球](https://pc.thread0.com/)) | [谷歌地球](https://earth.google.com/web/) | []() | []() | []() 29 | | 下载 | [savefrom](https://en1.savefrom.net/2ol/) | [cnet下载](https://archive.org/details/texts) | [3322](http://www.3322.cc/sort/index.html) | [pc6](http://www.pc6.com/) | [西西软件](http://www.cr173.com/) | [itmop](http://www.itmop.com/) 30 | | Linux | [rpmfind](http://fr2.rpmfind.net/) | [pkgs](https://pkgs.org/) | [RPM Search](http://rpm.pbone.net/) | | 31 | | [用药参考](http://drugs.medlive.cn/index.jsp) | [医案查询](http://www.gjmlzy.com:83/KBFmsSearch/Main/Index6) | [中药大全](http://zhongyao.m.supfree.net/) | [中医百科](https://zhongyibaike.com/wiki/%E5%9B%9B%E5%90%9B%E5%AD%90%E6%B1%A4) | 32 | | 中草药 | [植物图库](http://www.cses.tc.edu.tw/~tiwngien/picture%20datas/plant/oftensees.htm) | [福星花园](https://china-testing.github.io/bruce0342.blogspot.hk) | [认识植物](http://kplant.biodiv.tw/) | [中国植物志](http://frps.eflora.cn/) | [医学百科](http://www.a-hospital.com/w/%E7%99%BD%E8%83%8C%E5%8F%B6) | [中医书籍](http://www.zysj.com.cn/lilunshuji/index.html) 33 | | 调优 | [CPU优化](https://weedge.github.io/perf-book-cn/zh/chapters/4-Terminology-And-Metrics/4-5_Pipeline_Slot_cn.html) | [计算机系统基础](https://csci0300.github.io/) | [kunpeng pmu](https://elixir.bootlin.com/linux/v6.13.5/source/tools/perf/pmu-events/arch/arm64/hisilicon/hip09) | [libpfm4](https://github.com/wcohen/libpfm4) | [yet-another-bench-script](https://github.com/masonr/yet-another-bench-script) | [[stress-ng](https://github.com/ColinIanKing/stress-ng) 34 | | 调优 |[ [temci](https://github.com/parttimenerd/temci)| [计算机系统基础](https://csci0300.github.io/) | [kunpeng pmu](https://elixir.bootlin.com/linux/v6.13.5/source/tools/perf/pmu-events/arch/arm64/hisilicon/hip09) | [libpfm4](https://github.com/wcohen/libpfm4) | [yet-another-bench-script](https://github.com/masonr/yet-another-bench-script) | [[stress-ng](https://github.com/ColinIanKing/stress-ng) 35 | | 八字 | [中华典藏](https://www.diancang.xyz/xuanxuewushu/sanmingtonghui/) | [计算机系统基础](https://csci0300.github.io/) | [kunpeng pmu](ttps://elixir.bootlin.com/linux/v6.13.5/source/tools/perf/pmu-events/arch/arm64/hisilicon/hip09) | [libpfm4](https://github.com/wcohen/libpfm4) | [医学百科](http://www.a-hospital.com/w/%E7%99%BD%E8%83%8C%E5%8F%B6) | [中医书籍](http://www.zysj.com.cn/lilunshuji/index.html) 36 | 37 | **八字** 38 | 39 | - 排盘 40 | [元亨排盘](https://www.china95.net/paipan/bazi/) [子易排盘](http://forecasting.hk/8words/) [八字五行算命](http://www.chineseastrologyonline.com/CAGB.htm) [星相命理](http://tiger168.com/luckytop/lucky03.html) [哲学书电子化](https://ctext.org/wiki.pl?if=gb&res=595276&remap=gb) [造化元钥](http://www.guoxuedashi.net/a/22583b/) 41 | 42 | - 反推 43 | 44 | [中华预测网-1883-2031](http://www.zhycw.com/pp/index2.aspx) [天机妙算](https://test.askluck.com/bazi/fantui/) 45 | 46 | - 万年历 47 | 48 | [黄金易园](http://www.hjqing.com/find/2000/index.asp) [360](http://hao.360.cn/rili/) 49 | 50 | 51 | **软件** 52 | 53 | | 类别 | 名称 | 名称 | 名称 | 名称 | 名称 | 名称 | 54 | | --- | --- | --- | --- | --- | --- | --- | 55 | **软件** | [pdf转word](https://china-testing.github.io/www.free-pdf-to-word-converter.com/downloads/pdf-to-word-converter.exe) | [在线作图](https://www.draw.io/) | [软件替代](https://china-testing.github.io/alternativeto.net/software/beyond-compare/) | [7zip](https://china-testing.github.io/www.so.com/s?ie=utf-8&shb=1&src=360sou_home&q=7zip) | [Universal-USB-Installer](http://soft.so.com/search?q=Universal-USB-Installer) | [emclient](http://www.emclient.com/download) | [sumatrapd](http://www.sumatrapdfreader.org/downloadafter.html) 56 | 火狐插件 | oscobo |SwitchyOmega |RESTED |Video DownloadHelper 57 | chrome插件 |SwitchyOmega 58 | 代码评审 | [reviewboard](https://github.com/reviewboard/reviewboard) [rietveld](https://github.com/rietveld-codereview/rietveld) | [Gerrit](https://www.gerritcodereview.com/) | reviewboard的github评分较高 | [更多参考](https://en.wikipedia.org/wiki/List_of_tools_for_code_review) | [更多参考](https://www.google.com.hk/?gws_rd=ssl#safe=strict&q=best+code+review+tool) | 59 | 其他 |[wujie](https://github.com/wujieliulan/forum) |[etcher启动盘](https://etcher.balena.io/#download-etcher) 60 | 61 | 62 | https://github.com/yorkoliu/pyauto 63 | 64 | 修改pdf:Foxit PDF Editor 录屏:超级录屏 65 | 66 | [网络安全快速入门15-SQL注入](https://www.jianshu.com/p/e3db74639607) 67 | [网络安全快速入门1-什么是黑客?](https://www.jianshu.com/p/1e254809192e) 68 | [在项目中学习软件测试2安全测试](https://www.jianshu.com/p/c94125700e22) 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | * 技术支持qq群: 144081101(后期会录制视频存在该群群文件) 591302926 567351477 钉钉免费群:21745728 77 | 78 | * 道家技术-手相手诊看相中医等钉钉群21734177 qq群:391441566 184175668 338228106 看手相、面相、舌相、抽签、体质识别。服务费50元每人次起。请联系钉钉或者微信pythontesting 79 | 80 | -------------------------------------------------------------------------------- /articles.md: -------------------------------------------------------------------------------- 1 | * [国学 中医 历史等社科类书籍下载](https://github.com/china-testing/python-api-tesing/blob/master/society_books.md) 2 | * [电影 视频 下载](https://github.com/china-testing/python-api-tesing/blob/master/videos.md) 3 | * [IT类书籍 下载](https://github.com/china-testing/python-api-tesing/blob/master/books.md) 4 | 5 | 今日头条极速版看新闻可以赚钱,邀请码DBG8ADUK 6 | 7 | 8 | 9 | * [招聘](#hr) 10 | * [网络安全快速入门](#hack-quickstart) 11 | * [python测试开发笔试题面试题](#python-questions) 12 | * [软件测试](#testing) 13 | 14 | - 技术支持qq群:630011153 144081101 15 | 16 | # hr 17 | 18 | [平安产险数据平台招聘外包测试开发](https://www.jianshu.com/p/22aee46f7631) 19 | 20 | [平安产险技术岗2020年内部推荐-大数据测试开发工程师等-欢迎中年人](https://www.jianshu.com/p/e6255434be56) 21 | 22 | 23 | # python-questions 24 | 25 | [python经典面试题:列表和元组有什么异同?](https://www.jianshu.com/p/f13bf2bf1f05) 26 | 27 | [python requests库面试笔试题](https://www.jianshu.com/p/374dca87802b) 28 | 29 | [python条件判断面试笔试题](https://www.jianshu.com/p/ae3a59617ef7) 30 | 31 | [python并发面试笔试题](https://www.jianshu.com/p/e4f7e5637708) 32 | 33 | [python基础数据类型面试笔试题](https://www.jianshu.com/p/663f17c23b17) 34 | 35 | [python字典面试笔试题](https://www.jianshu.com/p/146b2ee5fe28) 36 | 37 | [python集合面试笔试题](https://www.jianshu.com/p/cd6a6586ff2b) 38 | 39 | [python字符串面试笔试题](https://www.jianshu.com/p/765879a94522) 40 | 41 | [Python经典面试题](https://www.jianshu.com/p/55cc75c99061) 42 | 43 | [Python经典面试题: 用3种方法实现堆栈和队列并示例实际应用场景](https://www.jianshu.com/p/c990427ca608) 44 | 45 | [python 3.7极速入门教程8语言比较与面试考试试题](https://www.jianshu.com/p/940664d1824a) 46 | 47 | 48 | # hack-quickstart 49 | 50 | 51 | 52 | [网络安全快速入门1-什么是黑客?](https://www.jianshu.com/p/1e254809192e) 53 | 54 | [网络安全快速入门2-计算机系统的潜在安全威胁](https://www.jianshu.com/p/7fd5cbbcdc02) 55 | 56 | [网络安全快速入门3-技能要求](https://www.jianshu.com/p/468cd06c7f26) 57 | 58 | [网络安全快速入门4-社会工程学](https://www.jianshu.com/p/0ea7dd1ed2d3) 59 | 60 | [网络安全快速入门5-密码学及密码破解工具CrypTool实战](https://www.jianshu.com/p/6c33fb28c9be) 61 | 62 | [网络安全快速入门15-SQL注入](https://www.jianshu.com/p/e3db74639607) 63 | 64 | # testing 65 | 66 | [平安产险数据平台招聘外包测试开发](https://www.jianshu.com/p/22aee46f7631) 67 | 68 | [平安产险技术岗2020年内部推荐-大数据测试开发工程师等-欢迎中年人](https://www.jianshu.com/p/e6255434be56) 69 | 70 | [2018软件测试标准汇总下载](https://www.jianshu.com/p/de8a6d138c62) 71 | 72 | [在项目中学习软件测试1网银测试](https://www.jianshu.com/p/99aeb2de6109) 73 | 74 | [在项目中学习软件测试2安全测试](https://www.jianshu.com/p/c94125700e22) 75 | 76 | [持续集成工具jenkins书籍](https://www.jianshu.com/p/3987b3fc3b81) 77 | 78 | [构建工具buildbot教程 持续交付与构建](https://www.jianshu.com/p/e4b090b84ee9) 79 | 80 | [软件测试工具书籍与面试题汇总下载(持续更新)](https://www.jianshu.com/p/455a874a42e8) 81 | 82 | [Pro Apache JMeter Web Application Performance Testing - 2017.pdf](https://www.jianshu.com/p/56125b1c91c0) 83 | 84 | [Performance Testing with JMeter 3 - Third Edition - 2017.pdf](https://www.jianshu.com/p/4c4ce0b8ba45) 85 | 86 | [伟大的测试人员的伟大测试工具 Great Testing Tools for Great Testers - 2016.pdf](https://www.jianshu.com/p/3f53170bf010) 87 | 88 | [书籍:ASTQB-BCS移动测试基础指南 Mobile Testing An ASTQB-BCS Foundation Guide - 2018.pdf](https://www.jianshu.com/p/a252732f8f1c) 89 | 90 | [书籍:Python渗透测试实战 Practical Security Automation and Testing(python)- 2019.pdf](https://www.jianshu.com/p/cbec5147d6be) 91 | 92 | [书籍:Python渗透测试实战 Hands-On Penetration Testing with Python - 2019.pdf](https://www.jianshu.com/p/5f63342c50f1) 93 | 94 | [书籍:Python Testing Cookbook, 2nd Edition - 2018.pdf python测试cookbook](https://www.jianshu.com/p/e03642383ea7) 95 | 96 | [Analytic Methods in Systems and Software Testing-2018 系统和软件测试分析方法](https://www.jianshu.com/p/20bf6848407d) 97 | 98 | [Python自动化测试新书下载: 使用Selenium工具和Python自动化浏览器](https://www.jianshu.com/p/8477aa2de10c) 99 | 100 | [接口测试面试题](https://www.jianshu.com/p/ceedb8696368) 101 | 102 | [为什么选择软件测试作为职业?](https://www.jianshu.com/p/d586a8ac3c7c) 103 | 104 | [软件测试精品文章与资源汇总](https://www.jianshu.com/p/faffa3983bbd) 105 | 106 | [软件自动化测试初学者忠告](https://www.jianshu.com/p/6a08dd5178df) 107 | 108 | [2019软件测试:移动应用性能测试:CheckList 工具(Andriod和iOS)](https://www.jianshu.com/p/745e998bc6d4) 109 | 110 | [性能测试艺术](https://www.jianshu.com/p/97db4dc786e3) 111 | 112 | [2019软件测试:游戏测试-如何测试移动/桌面应用程序](https://www.jianshu.com/p/62cc1628d170) 113 | 114 | [Android和iOS的14款最佳移动应用测试工具(2019年)](https://www.jianshu.com/p/51347e61a144) 115 | 116 | [使用Python学习selenium测试工具](https://www.jianshu.com/p/bed1b1a4691a) 117 | 118 | [selenium工具python快速入门1简介](https://www.jianshu.com/p/7d349a03befa) 119 | 120 | [WebView测试的5个最佳Python框架](https://www.jianshu.com/p/aa24bd8ddca0) 121 | 122 | [大数据工具Hadoop快速入门13大数据测试](https://www.jianshu.com/p/596256fa61d7) 123 | 124 | [降低软件质量的常见观点](https://www.jianshu.com/p/1a20a56f47c5) 125 | 126 | [请为linux cp设计测试用例](https://www.jianshu.com/p/d8f4ba733093) 127 | 128 | [软件测试指标](https://www.jianshu.com/p/8f6272114c54) 129 | 130 | [白盒测试快速入门1-简介](https://www.jianshu.com/p/78ab06468d25) 131 | 132 | [白盒测试快速入门2-静态测试](https://www.jianshu.com/p/9390763f36ed) 133 | 134 | [multi-mechanize性能测试工具](https://www.jianshu.com/p/90df7a1791f8) 135 | 136 | [2018最佳12个开源或免费web服务器和客户端性能测试工具](https://www.jianshu.com/p/52f32a312b9a) 137 | 138 | [性能测试工具ApacheBench](https://www.jianshu.com/p/c72402bfcca6) 139 | 140 | [性能测试工具boom-已迁移今日头条](https://www.jianshu.com/p/ccfcd722c495) 141 | 142 | [性能测试工具locustio](https://www.jianshu.com/p/1a8007d05982) 143 | 144 | [性能测试快速入门1-简介](https://www.jianshu.com/p/7fec01b3d368) 145 | 146 | [测试人员的职业发展图](https://www.jianshu.com/p/ff766857c24d) 147 | 148 | [性能测试工具nGrinder介绍](https://www.jianshu.com/p/89739a1920cb) 149 | 150 | [高效灵活的Java及python性能测试工具Grinder](https://www.jianshu.com/p/024a3474f68b) 151 | 152 | [使用jython进行dubbo接口及ngrinder性能测试](https://www.jianshu.com/p/5e627f880f5f) 153 | 154 | [敏捷测试开发快速入门教程1什么是敏捷方法论?](https://www.jianshu.com/p/4ed64c50089e) 155 | 156 | [敏捷测试开发快速入门教程2敏捷测试](https://www.jianshu.com/p/b489c2b3bab4) 157 | 158 | [敏捷测试开发快速入门教程4自动化测试](https://www.jianshu.com/p/6a993b0f82af) 159 | 160 | [软件测试快速入门1简介,基础知识和重要性](https://www.jianshu.com/p/6066789b7534) 161 | 162 | [软件测试快速入门2软件测试职业生涯](https://www.jianshu.com/p/c7ae894972bc) 163 | 164 | [软件测试快速入门3原则](https://www.jianshu.com/p/59dd7ea33b98) 165 | 166 | [软件测试快速入门4-V模型](https://www.jianshu.com/p/a4cbece5a78a) 167 | 168 | [软件测试快速入门5-进入退出标准](https://www.jianshu.com/p/132960eff76e) 169 | 170 | [项目管理快速入门1简介](https://www.jianshu.com/p/1368fa8fa21b) 171 | 172 | [项目管理快速入门2生命周期](https://www.jianshu.com/p/02f0a9706c74) 173 | 174 | [软件项目管理快速入门3项目成本管理和评估指南](https://www.jianshu.com/p/2ba973970aef) 175 | 176 | [项目管理快速入门4项目风险分析与管理](https://www.jianshu.com/p/2a72bc04e897) 177 | 178 | [项目管理快速入门5六西格玛(Six Sigma)认证指南](https://www.jianshu.com/p/5bf3e60103e7) 179 | 180 | [项目管理快速入门6项目管理方法教程](https://www.jianshu.com/p/fa2ad48763b7) 181 | 182 | [项目管理快速入门7-40个最佳项目管理工具[2019年7月名单]](https://www.jianshu.com/p/6f743352f316) 183 | 184 | 185 | [性能测试工具Locust和JMeter比较](https://www.jianshu.com/p/dd0fcfdfa561) 186 | 187 | [JMeter性能测试工具快速入门教程1简介](https://www.jianshu.com/p/b346e1d49d94) 188 | 189 | [JMeter性能测试工具快速入门教程3线程组,采样器,监听器,配置](https://www.jianshu.com/p/1137a98fd9c2) 190 | 191 | [JMeter性能测试工具快速入门教程4测试计划和工作台](https://www.jianshu.com/p/b40a2f5b037a) 192 | 193 | [JMeter性能测试工具快速入门教程5性能和负载测试](https://www.jianshu.com/p/bd0c7c4d53c8) 194 | 195 | [JMeter性能测试工具快速入门教程6定时器](https://www.jianshu.com/p/40527adb7091) 196 | 197 | [JMeter性能测试工具快速入门教程7断言](https://www.jianshu.com/p/7f84fe378ad7) 198 | 199 | [JMeter性能测试工具快速入门教程8逻辑控制器](https://www.jianshu.com/p/7e560961de48) 200 | 201 | [JMeter性能测试工具快速入门教程9处理器](https://www.jianshu.com/p/c65bec4cc972) 202 | 203 | [ETL测试工具简介](https://www.jianshu.com/p/23927950732d) 204 | 205 | [商业智能数据测试简介](https://www.jianshu.com/p/3168143d74b3) 206 | 207 | [数据测试指南](https://www.jianshu.com/p/601a86fa85c1) 208 | 209 | [数据测试教程](https://www.jianshu.com/p/380d0aad674e) 210 | 211 | [ETL测试数据仓库测试教程](https://www.jianshu.com/p/a05130a36016) 212 | 213 | [自动化测试框架工具pytest教程](https://www.jianshu.com/p/e8fa41d69a27) 214 | 215 | [自动化测试框架工具pytest教程1-快速入门](https://www.jianshu.com/p/cf644c704e6b) 216 | 217 | [自动化测试框架工具pytest教程2-测试函数](https://www.jianshu.com/p/4e512f8f8030) 218 | 219 | [pytest插件](https://www.jianshu.com/p/929894426a48) 220 | 221 | [pytest中文手册1安装和快速入门](https://www.jianshu.com/p/d88c978545b2) 222 | 223 | [网络和带宽分析的最佳数据包嗅探器工具](https://www.jianshu.com/p/985bf014f069) 224 | 225 | [Hive SQL单元测试介绍](https://www.jianshu.com/p/2c7631ab6cea) 226 | 227 | [移动应用测试1测试用例和测试场景](https://www.jianshu.com/p/2c4c17890c70) 228 | 229 | [移动应用测试-质量属性](https://www.jianshu.com/p/74b47e8028ca) 230 | 231 | [移动应用测试-环境和工具](https://www.jianshu.com/p/5703e8dd9af1) 232 | 233 | [移动应用测试计划](https://www.jianshu.com/p/5a741d0e8f5d) 234 | 235 | [测试工具: 2019年测试自动化最佳Python框架](https://www.jianshu.com/p/3d4c391f5dd7) 236 | 237 | [渗透测试工具简介1渗透测试简介](https://www.jianshu.com/p/58dafa47301f) 238 | 239 | [渗透测试工具简介2入侵工具](https://www.jianshu.com/p/25875c37d87e) 240 | 241 | [渗透测试工具简介11 SQL 注入](https://www.jianshu.com/p/fd688fd68269) 242 | 243 | [Google增强现实测试自动化工具介绍](https://www.jianshu.com/p/5dc89bac40a7) 244 | 245 | [selenium自动化测试工具python笔试面试项目实战5键盘操作](https://www.jianshu.com/p/a893ef19916a) 246 | 247 | [selenium自动化测试工具python笔试面试项目实战6 javascript操作](https://www.jianshu.com/p/62afcd9ec11d) 248 | 249 | [python测试工具开发面试宝典3web抓取](https://www.jianshu.com/p/1dd15283add9) 250 | 251 | [谷歌如何测试软件1Google软件测试介绍](https://www.jianshu.com/p/335e99d31795) 252 | 253 | [Google软件测试介绍2章软件测试开发工程师](https://www.jianshu.com/p/0bd9ac92cd92) 254 | 255 | [Google软件测试介绍3测试工程师](https://www.jianshu.com/p/5ecf85f236d8) 256 | 257 | [python web渗透测试工具学习1:Web应用渗透测试简介](https://www.jianshu.com/p/0b09e1019eea) 258 | 259 | [python web渗透测试工具学习2Web应用交互1HTTP基础](https://www.jianshu.com/p/2562338eda66) 260 | 261 | [使用python3和flask构建RESTful API(接口测试服务与mockserver工具)](https://www.jianshu.com/p/8ddfdabe6791) 262 | 263 | [flask工具构建自动化测试平台1-hello](https://www.jianshu.com/p/1370dffa7116) 264 | 265 | [flask工具构建自动化测试平台2-开始头条项目](https://www.jianshu.com/p/36fd2e377a1a) 266 | 267 | [flask构建自动化测试平台3-模板](https://www.jianshu.com/p/06753ff70337) 268 | 269 | [flask构建自动化测试平台4-用户输入](https://www.jianshu.com/p/2afefce4550b) 270 | 271 | [flask构建自动化测试平台5-提高用户体验](https://www.jianshu.com/p/a4e14a9d733a) 272 | 273 | [flask构建自动化测试平台6-交互式犯罪地图](https://www.jianshu.com/p/6ace93689e9a) 274 | 275 | [flask构建自动化测试平台7-添加google地图](https://www.jianshu.com/p/9a75e2a4256a) 276 | 277 | [flask工具构建自动化测试平台8-验证用户输入](https://www.jianshu.com/p/a1d0e10e1a88) 278 | 279 | [flask工具构建自动化测试平台9-点餐应用](https://www.jianshu.com/p/42c647220da1) 280 | 281 | [性能测试工具开发基础:python库介绍-multiprocessing:多进程](https://www.jianshu.com/p/5d5b6225edbc) 282 | 283 | [MD5值重复文件多进程检查工具check_md5.py - 性能测试工具开发](https://www.jianshu.com/p/ffa8e2da29bd) 284 | 285 | [可爱的python测试开发库及项目(python测试开发工具库汇总)](https://www.jianshu.com/p/ea6f7fb69501) 286 | 287 | [软件测试专家工具包1web测试](https://www.jianshu.com/p/be4da27b3260) 288 | 289 | [软件测试专家工具包2性能测试](https://www.jianshu.com/p/ab75be06ebb7) 290 | 291 | [软件测试专家工具包3移动端](https://www.jianshu.com/p/35262e4cc65a) 292 | 293 | 294 | 295 | 296 | 297 | -------------------------------------------------------------------------------- /django_examples/django_school/README.md: -------------------------------------------------------------------------------- 1 | ### 简介 2 | 3 | Django的书看了很多,却始终没胆量下手做实际的Web的开发?这里有一些企业应用的实例供学习。本例是一个考试系统。 4 | 5 | ![](https://upload-images.jianshu.io/upload_images/12713060-209b85544b88e089.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 6 | 7 | 教师可以创建测验,学生可以注册并参加与他们兴趣相关的测验。 8 | 9 | ### 安装 10 | ```python 11 | $ git clone https://github.com/china-testing/python_cn_resouce 12 | $ cd django_examples/django_school/ 13 | $ pip install -r requirements.txt 14 | $ python manage.py migrate 15 | $ python manage.py loaddata datas.json 16 | $ python manage.py runserver 17 | ``` 18 | ### 初始用户 19 | - 学生 20 | - username: teacher 21 | - password: teacher 22 | 23 | - 教师 24 | - username: student 25 | - password: student 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/china-testing/python_cn_resouce/2eee52f3fa304899d749e7f6f3b613ada87a0ff9/django_examples/django_school/classroom/__init__.py -------------------------------------------------------------------------------- /django_examples/django_school/classroom/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | from .models import (User, Subject, Quiz, Question, 5 | Answer, Student, TakenQuiz, AuditEntry) 6 | 7 | 8 | @admin.register(AuditEntry) 9 | class AuditEntryAdmin(admin.ModelAdmin): 10 | readonly_fields = ['log_time',] 11 | list_display = ['action', 'username', 'log_time','show_ip_url',] 12 | list_filter = ['action',] 13 | 14 | def show_ip_url(self, obj): 15 | ip = obj.ip 16 | if ip in [None,'127.0.0.1']: return ip 17 | from django.utils.html import format_html 18 | url = f'https://ipinfo.io/{obj.ip}/json' # https://stackoverflow.com/a/55432323/2351696 19 | 20 | return format_html("{ip}", url=url, ip=ip) 21 | 22 | # admin.site.register(AuditEntry) 23 | 24 | admin.site.register(User) 25 | admin.site.register(Subject) 26 | admin.site.register(Quiz) 27 | admin.site.register(Question) 28 | admin.site.register(Answer) 29 | admin.site.register(Student) 30 | admin.site.register(TakenQuiz) -------------------------------------------------------------------------------- /django_examples/django_school/classroom/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ClassroomConfig(AppConfig): 5 | name = 'classroom' 6 | def ready(self): 7 | import classroom.signals 8 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/decorators.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth import REDIRECT_FIELD_NAME 2 | from django.contrib.auth.decorators import user_passes_test 3 | 4 | 5 | def student_required(function=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url='login'): 6 | ''' 7 | Decorator for views that checks that the logged in user is a student, 8 | redirects to the log-in page if necessary. 9 | ''' 10 | actual_decorator = user_passes_test( 11 | lambda u: u.is_active and u.is_student, 12 | login_url=login_url, 13 | redirect_field_name=redirect_field_name 14 | ) 15 | if function: 16 | return actual_decorator(function) 17 | return actual_decorator 18 | 19 | 20 | def teacher_required(function=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url='login'): 21 | ''' 22 | Decorator for views that checks that the logged in user is a teacher, 23 | redirects to the log-in page if necessary. 24 | ''' 25 | actual_decorator = user_passes_test( 26 | lambda u: u.is_active and u.is_teacher, 27 | login_url=login_url, 28 | redirect_field_name=redirect_field_name 29 | ) 30 | if function: 31 | return actual_decorator(function) 32 | return actual_decorator 33 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/fixtures/datas.json: -------------------------------------------------------------------------------- 1 | [ 2 | {"model": "classroom.subject", "pk": 1, "fields": {"name": "艺术", "color": "#343a40"}}, 3 | {"model": "classroom.subject", "pk": 2, "fields": {"name": "计算机", "color": "#007bff"}}, 4 | {"model": "classroom.subject", "pk": 3, "fields": {"name": "数学", "color": "#28a745"}}, 5 | {"model": "classroom.subject", "pk": 4, "fields": {"name": "生物", "color": "#17a2b8"}}, 6 | {"model": "classroom.subject", "pk": 5, "fields": {"name": "历史", "color": "#ffc107"}}, 7 | 8 | {"model": "classroom.question", "pk": 1, "fields": {"quiz": 1, "text": "When was the Treaty of Versailles signed?"}}, 9 | {"model": "classroom.question", "pk": 2, "fields": {"quiz": 1, "text": "Britain, France, USA, Germany, Italy, and Russia."}}, 10 | {"model": "classroom.question", "pk": 3, "fields": {"quiz": 1, "text": "The war ended on November 11 1918."}}, 11 | {"model": "classroom.question", "pk": 4, "fields": {"quiz": 1, "text": "The name of the new government in Germany was called the Wiemar Republic."}}, 12 | 13 | {"model": "classroom.question", "pk": 5, "fields": {"quiz": 2, "text": "An advantage of using solar power is"}}, 14 | {"model": "classroom.question", "pk": 6, "fields": {"quiz": 2, "text": "An advantage of using hydroelectric power is"}}, 15 | {"model": "classroom.question", "pk": 7, "fields": {"quiz": 2, "text": "Most utility companies in the U.S. dont use hydroelectric power because"}}, 16 | {"model": "classroom.question", "pk": 8, "fields": {"quiz": 2, "text": "Which energy source would be best for a city that has limited space and want to be effecient?"}}, 17 | {"model": "classroom.question", "pk": 9, "fields": {"quiz": 2, "text": "What is a major disadvantage of nuclear power?"}}, 18 | {"model": "classroom.question", "pk": 10, "fields": {"quiz": 2, "text": "If a community were choosing between solar and wind; what advantage would make wind the best choice?"}}, 19 | {"model": "classroom.question", "pk": 11, "fields": {"quiz": 2, "text": "An advantage of burning coal for energy is"}}, 20 | {"model": "classroom.question", "pk": 12, "fields": {"quiz": 2, "text": "An advantage of using natural gas as a form of energy is"}}, 21 | {"model": "classroom.question", "pk": 13, "fields": {"quiz": 2, "text": "What do geothermal and solar energy have in common?"}}, 22 | {"model": "classroom.question", "pk": 14, "fields": {"quiz": 3, "text": "What happens when url.py file is edited while the development server is still running?"}}, 23 | {"model": "classroom.question", "pk": 15, "fields": {"quiz": 3, "text": "Which setting contains the parameter of main-urls file?"}}, 24 | {"model": "classroom.question", "pk": 16, "fields": {"quiz": 3, "text": "What is the purpose of __init__.py in project directories?"}}, 25 | {"model": "classroom.question", "pk": 17, "fields": {"quiz": 3, "text": "Which method is used instead of path() in urls.py to pass in regular expressions as routes?"}}, 26 | {"model": "classroom.question", "pk": 18, "fields": {"quiz": 3, "text": "What does {{ forloop.counter }} inside a forloop tag prints?"}}, 27 | {"model": "classroom.question", "pk": 19, "fields": {"quiz": 3, "text": "This template {# #} is used for?"}}, 28 | {"model": "classroom.question", "pk": 20, "fields": {"quiz": 4, "text": "What does {% include %} does?"}}, 29 | {"model": "classroom.question", "pk": 21, "fields": {"quiz": 4, "text": "What would \"Post.objects.filter(heading=\"Post 1\")\""}}, 30 | {"model": "classroom.question", "pk": 22, "fields": {"quiz": 4, "text": "Suppose you want to count the number of books in Django with \"books = Book.objects.all()\". Which implementation would be fastest?"}}, 31 | {"model": "classroom.question", "pk": 23, "fields": {"quiz": 5, "text": "What is the name of the file that Django provides for managing a newly-created project and its applications?"}}, 32 | {"model": "classroom.question", "pk": 24, "fields": {"quiz": 5, "text": "What task do migrations automate?"}}, 33 | {"model": "classroom.question", "pk": 25, "fields": {"quiz": 5, "text": "What kind of relation is defined between models Order and OrderItems by invoking ForeignKey(Order) in the class definition for model OrderItems?"}}, 34 | 35 | {"model": "classroom.answer", "pk": 1, "fields": {"question": 1, "text": "June 29 of 1919", "is_correct": true}}, 36 | {"model": "classroom.answer", "pk": 2, "fields": {"question": 1, "text": "June 29 of 1920", "is_correct": false}}, 37 | {"model": "classroom.answer", "pk": 3, "fields": {"question": 1, "text": "March 29 of 1919", "is_correct": false}}, 38 | {"model": "classroom.answer", "pk": 4, "fields": {"question": 1, "text": "August 29 of 1920", "is_correct": false}}, 39 | {"model": "classroom.answer", "pk": 5, "fields": {"question": 2, "text": "How much money did Germany have to pay as a reparation?", "is_correct": false}}, 40 | {"model": "classroom.answer", "pk": 6, "fields": {"question": 2, "text": "Which countries were involved in World War 1?", "is_correct": true}}, 41 | {"model": "classroom.answer", "pk": 7, "fields": {"question": 2, "text": "What does BRAT stand for in the Treaty of Versailles?", "is_correct": false}}, 42 | {"model": "classroom.answer", "pk": 8, "fields": {"question": 2, "text": "What does MAIN stand for when it comes to the causes of the first world war?", "is_correct": false}}, 43 | {"model": "classroom.answer", "pk": 9, "fields": {"question": 3, "text": "When was the Treaty of Versailles signed?", "is_correct": true}}, 44 | {"model": "classroom.answer", "pk": 10, "fields": {"question": 3, "text": "Why did Germany declare war on Russia?", "is_correct": false}}, 45 | {"model": "classroom.answer", "pk": 11, "fields": {"question": 3, "text": "When did World War 1 begin?", "is_correct": false}}, 46 | {"model": "classroom.answer", "pk": 12, "fields": {"question": 3, "text": "When did World War 1 end?", "is_correct": false}}, 47 | {"model": "classroom.answer", "pk": 13, "fields": {"question": 4, "text": "What does MAIN stand for when it comes to the causes of the first world war?", "is_correct": false}}, 48 | {"model": "classroom.answer", "pk": 14, "fields": {"question": 4, "text": "What was the name of the new government in Germany after World War 1?", "is_correct": true}}, 49 | {"model": "classroom.answer", "pk": 15, "fields": {"question": 4, "text": "Were the Big Three happy about the outcome of the Treaty of Versailles?", "is_correct": false}}, 50 | {"model": "classroom.answer", "pk": 16, "fields": {"question": 4, "text": "How much money did Germany have to pay as a reparation?", "is_correct": false}}, 51 | {"model": "classroom.answer", "pk": 17, "fields": {"question": 5, "text": "no greenhouse gases", "is_correct": true}}, 52 | {"model": "classroom.answer", "pk": 18, "fields": {"question": 5, "text": "lots of pollution", "is_correct": false}}, 53 | {"model": "classroom.answer", "pk": 19, "fields": {"question": 5, "text": "it is available even on cloudy days", "is_correct": false}}, 54 | {"model": "classroom.answer", "pk": 20, "fields": {"question": 6, "text": "reservoirs can be used for irrigation of crops", "is_correct": true}}, 55 | {"model": "classroom.answer", "pk": 21, "fields": {"question": 6, "text": "sometimes surrounding area get flooded", "is_correct": false}}, 56 | {"model": "classroom.answer", "pk": 22, "fields": {"question": 6, "text": "the normal flow of the water is diverted", "is_correct": false}}, 57 | {"model": "classroom.answer", "pk": 23, "fields": {"question": 7, "text": "the plants are expensive to build and use expensive machinery", "is_correct": true}}, 58 | {"model": "classroom.answer", "pk": 24, "fields": {"question": 7, "text": "reservoirs can be used to irrigate crops and they dont want to help farmers", "is_correct": false}}, 59 | {"model": "classroom.answer", "pk": 25, "fields": {"question": 7, "text": "the cause a lot of greenhouse gass", "is_correct": false}}, 60 | {"model": "classroom.answer", "pk": 26, "fields": {"question": 8, "text": "solar-costly to build and 6%-30% efficient", "is_correct": false}}, 61 | {"model": "classroom.answer", "pk": 27, "fields": {"question": 8, "text": "Wind-turbines need lots of free space 40%-60% efficient", "is_correct": false}}, 62 | {"model": "classroom.answer", "pk": 28, "fields": {"question": 8, "text": "Natural gas-can be used in small areas 50%-60% efficient", "is_correct": true}}, 63 | {"model": "classroom.answer", "pk": 29, "fields": {"question": 9, "text": "it produces small amounts of power", "is_correct": false}}, 64 | {"model": "classroom.answer", "pk": 30, "fields": {"question": 9, "text": "the by-product(waste) is nuclear radiation", "is_correct": true}}, 65 | {"model": "classroom.answer", "pk": 31, "fields": {"question": 9, "text": "power plants are inexpensive to build", "is_correct": false}}, 66 | {"model": "classroom.answer", "pk": 32, "fields": {"question": 10, "text": "locations for turbines are limited because the wind can be blocked", "is_correct": false}}, 67 | {"model": "classroom.answer", "pk": 33, "fields": {"question": 10, "text": "solar needs a back up system for cloudy days", "is_correct": false}}, 68 | {"model": "classroom.answer", "pk": 34, "fields": {"question": 10, "text": "wind energy is less expensive and it is limitless", "is_correct": true}}, 69 | {"model": "classroom.answer", "pk": 35, "fields": {"question": 11, "text": "it is an inexpensive source of energy", "is_correct": true}}, 70 | {"model": "classroom.answer", "pk": 36, "fields": {"question": 11, "text": "it does not pollute the air", "is_correct": false}}, 71 | {"model": "classroom.answer", "pk": 37, "fields": {"question": 11, "text": "it is a renewable energy source", "is_correct": false}}, 72 | {"model": "classroom.answer", "pk": 38, "fields": {"question": 12, "text": "it is more expensive compared to other fossil fuels", "is_correct": false}}, 73 | {"model": "classroom.answer", "pk": 39, "fields": {"question": 12, "text": "It produces low emissions(pollution) compared to other fossil fuels", "is_correct": true}}, 74 | {"model": "classroom.answer", "pk": 40, "fields": {"question": 12, "text": "there is a more limited supply compared to other fossil fuels", "is_correct": false}}, 75 | {"model": "classroom.answer", "pk": 41, "fields": {"question": 13, "text": "they both use sunlight to generate energy", "is_correct": false}}, 76 | {"model": "classroom.answer", "pk": 42, "fields": {"question": 13, "text": "both are non-renewable energy sources", "is_correct": false}}, 77 | {"model": "classroom.answer", "pk": 43, "fields": {"question": 13, "text": "neither produce greenhouse gass", "is_correct": true}}, 78 | {"model": "classroom.answer", "pk": 44, "fields": {"question": 14, "text": "Development server terminates.", "is_correct": false}}, 79 | {"model": "classroom.answer", "pk": 45, "fields": {"question": 14, "text": "The development server automatically restarts.", "is_correct": true}}, 80 | {"model": "classroom.answer", "pk": 46, "fields": {"question": 14, "text": "The development server does nothing.", "is_correct": false}}, 81 | {"model": "classroom.answer", "pk": 47, "fields": {"question": 14, "text": "The web page is automatically reloaded.", "is_correct": false}}, 82 | {"model": "classroom.answer", "pk": 48, "fields": {"question": 15, "text": "ROOT_URLCONF", "is_correct": true}}, 83 | {"model": "classroom.answer", "pk": 49, "fields": {"question": 15, "text": "MAIN_URLCONF", "is_correct": false}}, 84 | {"model": "classroom.answer", "pk": 50, "fields": {"question": 15, "text": "STATIC_URL", "is_correct": false}}, 85 | {"model": "classroom.answer", "pk": 51, "fields": {"question": 15, "text": "MEDIA_URL", "is_correct": false}}, 86 | {"model": "classroom.answer", "pk": 52, "fields": {"question": 16, "text": "It allows Python to recognise the folder as package.", "is_correct": true}}, 87 | {"model": "classroom.answer", "pk": 53, "fields": {"question": 16, "text": "It is useless and can be deleted.", "is_correct": false}}, 88 | {"model": "classroom.answer", "pk": 54, "fields": {"question": 16, "text": "It is used to initialise any empty values.", "is_correct": false}}, 89 | {"model": "classroom.answer", "pk": 55, "fields": {"question": 16, "text": "None of the above", "is_correct": false}}, 90 | {"model": "classroom.answer", "pk": 56, "fields": {"question": 17, "text": "static()", "is_correct": false}}, 91 | {"model": "classroom.answer", "pk": 57, "fields": {"question": 17, "text": "re_path()", "is_correct": true}}, 92 | {"model": "classroom.answer", "pk": 58, "fields": {"question": 17, "text": "include()", "is_correct": false}}, 93 | {"model": "classroom.answer", "pk": 59, "fields": {"question": 17, "text": "None of the above", "is_correct": false}}, 94 | {"model": "classroom.answer", "pk": 60, "fields": {"question": 18, "text": "The current iteration of the loop (1-indexed)", "is_correct": true}}, 95 | {"model": "classroom.answer", "pk": 61, "fields": {"question": 18, "text": "The current iteration of the loop (0-indexed)", "is_correct": false}}, 96 | {"model": "classroom.answer", "pk": 62, "fields": {"question": 18, "text": "It will not print \"loop variable is not defined\"", "is_correct": false}}, 97 | {"model": "classroom.answer", "pk": 63, "fields": {"question": 18, "text": "None of the above", "is_correct": false}}, 98 | {"model": "classroom.answer", "pk": 64, "fields": {"question": 19, "text": "It is used for business logic.", "is_correct": false}}, 99 | {"model": "classroom.answer", "pk": 65, "fields": {"question": 19, "text": "It is comment in template language.", "is_correct": true}}, 100 | {"model": "classroom.answer", "pk": 66, "fields": {"question": 19, "text": "It will raise an exception.", "is_correct": false}}, 101 | {"model": "classroom.answer", "pk": 67, "fields": {"question": 19, "text": "None of the above", "is_correct": false}}, 102 | {"model": "classroom.answer", "pk": 68, "fields": {"question": 20, "text": "It will include another template.", "is_correct": true}}, 103 | {"model": "classroom.answer", "pk": 69, "fields": {"question": 20, "text": "It will include content from another template having the same templates defined.", "is_correct": false}}, 104 | {"model": "classroom.answer", "pk": 70, "fields": {"question": 20, "text": "It is the same as {% extend %}.", "is_correct": false}}, 105 | {"model": "classroom.answer", "pk": 71, "fields": {"question": 20, "text": "None of the above", "is_correct": false}}, 106 | {"model": "classroom.answer", "pk": 72, "fields": {"question": 21, "text": "It will print the first object which matched with heading \"Post 1\"", "is_correct": false}}, 107 | {"model": "classroom.answer", "pk": 73, "fields": {"question": 21, "text": "It will print all objects", "is_correct": false}}, 108 | {"model": "classroom.answer", "pk": 74, "fields": {"question": 21, "text": "It will print all the objects which match the heading \"Post 1\"", "is_correct": true}}, 109 | {"model": "classroom.answer", "pk": 75, "fields": {"question": 22, "text": "Database level Implementation - books.count()", "is_correct": true}}, 110 | {"model": "classroom.answer", "pk": 76, "fields": {"question": 22, "text": "Python Implementation - len(books)", "is_correct": false}}, 111 | {"model": "classroom.answer", "pk": 77, "fields": {"question": 22, "text": "Template Language Implementation - {{ books | length }}", "is_correct": false}}, 112 | {"model": "classroom.answer", "pk": 78, "fields": {"question": 22, "text": "None of the above", "is_correct": false}}, 113 | {"model": "classroom.answer", "pk": 79, "fields": {"question": 23, "text": "django", "is_correct": false}}, 114 | {"model": "classroom.answer", "pk": 80, "fields": {"question": 23, "text": "manage.py", "is_correct": true}}, 115 | {"model": "classroom.answer", "pk": 81, "fields": {"question": 23, "text": "apachectl", "is_correct": false}}, 116 | {"model": "classroom.answer", "pk": 82, "fields": {"question": 23, "text": "pip", "is_correct": false}}, 117 | {"model": "classroom.answer", "pk": 83, "fields": {"question": 24, "text": "Structural changes to project database tables to reflect changes to data models", "is_correct": true}}, 118 | {"model": "classroom.answer", "pk": 84, "fields": {"question": 24, "text": "Deployment of project data to production server", "is_correct": false}}, 119 | {"model": "classroom.answer", "pk": 85, "fields": {"question": 24, "text": "Internationalization of site content to reflect local differences in local date and currency formatting conventions", "is_correct": false}}, 120 | {"model": "classroom.answer", "pk": 86, "fields": {"question": 25, "text": "Many to one: Multiple OrderItems can have same Order", "is_correct": true}}, 121 | {"model": "classroom.answer", "pk": 87, "fields": {"question": 25, "text": "One to one: Each OrderItems must have Unique Order", "is_correct": false}}, 122 | {"model": "classroom.answer", "pk": 88, "fields": {"question": 25, "text": "One to many: Each OrderItems can have Multiple Order", "is_correct": false}}, 123 | 124 | {"model": "classroom.quiz", "pk": 1, "fields": {"owner": 1, "name": "World War 1", "subject": 5}}, 125 | {"model": "classroom.quiz", "pk": 2, "fields": {"owner": 1, "name": "EnergySources", "subject": 4}}, 126 | {"model": "classroom.quiz", "pk": 3, "fields": {"owner": 1, "name": "Django2", "subject": 2}}, 127 | {"model": "classroom.quiz", "pk": 4, "fields": {"owner": 1, "name": "Django3", "subject": 2}}, 128 | {"model": "classroom.quiz", "pk": 5, "fields": {"owner": 1, "name": "Django1", "subject": 2}}, 129 | 130 | {"model": "classroom.user", "pk": 1, "fields": {"password": "pbkdf2_sha256$180000$og6o8PzLsRNC$/Ay4/y7/plwM2t3MGrzUoGvTKCqRlrSYmCwrkL9VrVY=", "last_login": "2020-03-19T02:20:24.490Z", "is_superuser": true, "username": "teacher", "first_name": "Teacher", "last_name": "", "email": "", "is_staff": true, "is_active": true, "date_joined": "2020-03-19T02:20:24.014Z", "is_student": false, "is_teacher": true, "groups": [], "user_permissions": []}}, 131 | {"model": "classroom.user", "pk": 2, "fields": {"password": "pbkdf2_sha256$180000$DBSRJ8mc0QUn$aCBAYWUqewnK+nJ1FqSBQpnvY33P/FpK2CAYyQuX1p0=", "last_login": "2020-03-19T02:19:48.856Z", "is_superuser": false, "username": "student", "first_name": "Student", "last_name": "", "email": "", "is_staff": false, "is_active": true, "date_joined": "2020-03-19T02:19:48.411Z", "is_student": true, "is_teacher": false, "groups": [], "user_permissions": []}}, 132 | 133 | {"model": "classroom.student", "pk": 2, "fields": {"score": 0, "interests": [2, 3, 4, 5]}} 134 | ] -------------------------------------------------------------------------------- /django_examples/django_school/classroom/fixtures/quizzes.json: -------------------------------------------------------------------------------- 1 | [{"model": "classroom.quiz", "pk": 2, "fields": {"owner": 1, "name": "KEAM 2017 paper 1", "subject": 3}}, 2 | 3 | {"model": "classroom.answer", "pk": 1, "fields": {"question": 1, "text": "$$\\ce{H2O + HCl <=> H3O+ + Cl-}$$", "is_correct": true}}, 4 | {"model": "classroom.answer", "pk": 2, "fields": {"question": 1, "text": "gdfs", "is_correct": false}}, 5 | {"model": "classroom.answer", "pk": 3, "fields": {"question": 2, "text": "(a) and (b)", "is_correct": true}}, 6 | {"model": "classroom.answer", "pk": 4, "fields": {"question": 2, "text": "(a) and (c)", "is_correct": false}}, 7 | {"model": "classroom.answer", "pk": 5, "fields": {"question": 2, "text": "(a), (b) and (c)", "is_correct": false}}, 8 | {"model": "classroom.answer", "pk": 6, "fields": {"question": 2, "text": "all", "is_correct": false}}, 9 | {"model": "classroom.answer", "pk": 7, "fields": {"question": 3, "text": "combination reaction.", "is_correct": false}}, 10 | {"model": "classroom.answer", "pk": 8, "fields": {"question": 3, "text": "double displacement reaction.", "is_correct": false}}, 11 | {"model": "classroom.answer", "pk": 9, "fields": {"question": 3, "text": "decomposition reaction.", "is_correct": false}}, 12 | {"model": "classroom.answer", "pk": 10, "fields": {"question": 3, "text": "displacement reaction.", "is_correct": true}}, 13 | {"model": "classroom.answer", "pk": 11, "fields": {"question": 4, "text": "Hydrogen gas and iron chloride are produced.", "is_correct": true}}, 14 | {"model": "classroom.answer", "pk": 12, "fields": {"question": 4, "text": "Chlorine gas and iron hydroxide are produced.", "is_correct": false}}, 15 | {"model": "classroom.answer", "pk": 13, "fields": {"question": 4, "text": "No reaction takes place.", "is_correct": false}}, 16 | {"model": "classroom.answer", "pk": 14, "fields": {"question": 4, "text": "Iron salt and water are produce", "is_correct": false}}, 17 | 18 | {"model": "classroom.answer", "pk": 15, "fields": {"question": 5, "text": "45", "is_correct": false}}, 19 | {"model": "classroom.answer", "pk": 16, "fields": {"question": 5, "text": "45\\(\\pi\\)", "is_correct": true}}, 20 | {"model": "classroom.answer", "pk": 17, "fields": {"question": 5, "text": "250\\(\\pi\\)", "is_correct": false}}, 21 | {"model": "classroom.answer", "pk": 18, "fields": {"question": 5, "text": "250", "is_correct": false}}, 22 | {"model": "classroom.answer", "pk": 19, "fields": {"question": 5, "text": "450", "is_correct": false}}, 23 | {"model": "classroom.answer", "pk": 20, "fields": {"question": 6, "text": "can be decreased by increasing the number of readings and averaging them", "is_correct": true}}, 24 | {"model": "classroom.answer", "pk": 21, "fields": {"question": 6, "text": "can be decreased by changing the person who takes the reading", "is_correct": false}}, 25 | {"model": "classroom.answer", "pk": 22, "fields": {"question": 6, "text": "can be decreased by using new instrument", "is_correct": false}}, 26 | {"model": "classroom.answer", "pk": 23, "fields": {"question": 6, "text": "can be decreased by using a different method in taking the reading", "is_correct": false}}, 27 | {"model": "classroom.answer", "pk": 24, "fields": {"question": 6, "text": "can never be decreased", "is_correct": false}}, 28 | {"model": "classroom.answer", "pk": 25, "fields": {"question": 7, "text": "4.99 s", "is_correct": true}}, 29 | {"model": "classroom.answer", "pk": 26, "fields": {"question": 7, "text": "5.0 s", "is_correct": false}}, 30 | {"model": "classroom.answer", "pk": 27, "fields": {"question": 7, "text": "5.00 s", "is_correct": false}}, 31 | {"model": "classroom.answer", "pk": 28, "fields": {"question": 7, "text": "4.9 s", "is_correct": false}}, 32 | {"model": "classroom.answer", "pk": 29, "fields": {"question": 7, "text": "5.1 s", "is_correct": false}}, 33 | {"model": "classroom.answer", "pk": 30, "fields": {"question": 8, "text": "\\(40 km/h^2\\)", "is_correct": true}}, 34 | {"model": "classroom.answer", "pk": 31, "fields": {"question": 8, "text": "\\(80 km/h^2\\)", "is_correct": false}}, 35 | {"model": "classroom.answer", "pk": 32, "fields": {"question": 8, "text": "\\(100 km/h^2\\)", "is_correct": false}}, 36 | {"model": "classroom.answer", "pk": 33, "fields": {"question": 8, "text": "\\(120 km/h^2\\)", "is_correct": false}}, 37 | {"model": "classroom.answer", "pk": 34, "fields": {"question": 8, "text": "\\(160 km/h^2\\)", "is_correct": false}} 38 | 39 | ] 40 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from django.contrib.auth.forms import UserCreationForm 3 | from django.db import transaction 4 | from django.forms.utils import ValidationError 5 | 6 | from classroom.models import (Answer, Question, Student, StudentAnswer, 7 | Subject, User) 8 | 9 | 10 | class TeacherSignUpForm(UserCreationForm): 11 | class Meta(UserCreationForm.Meta): 12 | model = User 13 | 14 | def save(self, commit=True): 15 | user = super().save(commit=False) 16 | user.is_teacher = True 17 | if commit: 18 | user.save() 19 | return user 20 | 21 | 22 | class StudentSignUpForm(UserCreationForm): 23 | interests = forms.ModelMultipleChoiceField( 24 | queryset=Subject.objects.all(), 25 | widget=forms.CheckboxSelectMultiple, 26 | required=True 27 | ) 28 | 29 | class Meta(UserCreationForm.Meta): 30 | model = User 31 | 32 | @transaction.atomic 33 | def save(self): 34 | user = super().save(commit=False) 35 | user.is_student = True 36 | user.save() 37 | student = Student.objects.create(user=user) 38 | student.interests.add(*self.cleaned_data.get('interests')) 39 | return user 40 | 41 | 42 | class StudentInterestsForm(forms.ModelForm): 43 | class Meta: 44 | model = Student 45 | fields = ('interests', ) 46 | widgets = { 47 | 'interests': forms.CheckboxSelectMultiple 48 | } 49 | 50 | 51 | class QuestionForm(forms.ModelForm): 52 | class Meta: 53 | model = Question 54 | fields = ('text', ) 55 | 56 | 57 | class BaseAnswerInlineFormSet(forms.BaseInlineFormSet): 58 | def clean(self): 59 | super().clean() 60 | 61 | has_one_correct_answer = False 62 | for form in self.forms: 63 | if not form.cleaned_data.get('DELETE', False): 64 | if form.cleaned_data.get('is_correct', False): 65 | has_one_correct_answer = True 66 | break 67 | if not has_one_correct_answer: 68 | raise ValidationError('Mark at least one answer as correct.', code='no_correct_answer') 69 | 70 | 71 | class TakeQuizForm(forms.ModelForm): 72 | answer = forms.ModelChoiceField( 73 | queryset=Answer.objects.none(), 74 | widget=forms.RadioSelect(), 75 | required=True, 76 | empty_label=None) 77 | 78 | class Meta: 79 | model = StudentAnswer 80 | fields = ('answer', ) 81 | 82 | def __init__(self, *args, **kwargs): 83 | question = kwargs.pop('question') 84 | super().__init__(*args, **kwargs) 85 | self.fields['answer'].queryset = question.answers.order_by('text') 86 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/functional_tests.py: -------------------------------------------------------------------------------- 1 | # pip install selenium 2 | # https://askubuntu.com/questions/870530/how-to-install-geckodriver-in-ubuntu 3 | 4 | from selenium import webdriver 5 | browser = webdriver.Firefox() 6 | browser.get('http://localhost:8000') 7 | 8 | assert 'Django' in browser.title -------------------------------------------------------------------------------- /django_examples/django_school/classroom/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.9 on 2022-01-16 09:03 2 | 3 | from django.conf import settings 4 | import django.contrib.auth.models 5 | import django.contrib.auth.validators 6 | from django.db import migrations, models 7 | import django.db.models.deletion 8 | import django.utils.timezone 9 | 10 | 11 | class Migration(migrations.Migration): 12 | 13 | initial = True 14 | 15 | dependencies = [ 16 | ('auth', '0012_alter_user_first_name_max_length'), 17 | ] 18 | 19 | operations = [ 20 | migrations.CreateModel( 21 | name='User', 22 | fields=[ 23 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 24 | ('password', models.CharField(max_length=128, verbose_name='password')), 25 | ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), 26 | ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), 27 | ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), 28 | ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')), 29 | ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), 30 | ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), 31 | ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), 32 | ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), 33 | ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), 34 | ('is_student', models.BooleanField(default=False)), 35 | ('is_teacher', models.BooleanField(default=False)), 36 | ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), 37 | ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), 38 | ], 39 | options={ 40 | 'verbose_name': 'user', 41 | 'verbose_name_plural': 'users', 42 | 'abstract': False, 43 | }, 44 | managers=[ 45 | ('objects', django.contrib.auth.models.UserManager()), 46 | ], 47 | ), 48 | migrations.CreateModel( 49 | name='Subject', 50 | fields=[ 51 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 52 | ('name', models.CharField(max_length=30)), 53 | ('color', models.CharField(default='#007bff', max_length=7)), 54 | ], 55 | ), 56 | migrations.CreateModel( 57 | name='Student', 58 | fields=[ 59 | ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='classroom.user')), 60 | ('score', models.IntegerField(default=0)), 61 | ('interests', models.ManyToManyField(related_name='interested_students', to='classroom.Subject')), 62 | ], 63 | ), 64 | migrations.CreateModel( 65 | name='Quiz', 66 | fields=[ 67 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 68 | ('name', models.CharField(max_length=255)), 69 | ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='quizzes', to=settings.AUTH_USER_MODEL)), 70 | ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='quizzes', to='classroom.subject')), 71 | ], 72 | ), 73 | migrations.CreateModel( 74 | name='Question', 75 | fields=[ 76 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 77 | ('text', models.TextField(verbose_name='Question')), 78 | ('quiz', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='questions', to='classroom.quiz')), 79 | ], 80 | ), 81 | migrations.CreateModel( 82 | name='Answer', 83 | fields=[ 84 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 85 | ('text', models.CharField(max_length=255, verbose_name='Answer')), 86 | ('is_correct', models.BooleanField(default=False, verbose_name='Correct answer')), 87 | ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='classroom.question')), 88 | ], 89 | ), 90 | migrations.CreateModel( 91 | name='TakenQuiz', 92 | fields=[ 93 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 94 | ('score', models.IntegerField()), 95 | ('percentage', models.FloatField()), 96 | ('date', models.DateTimeField(auto_now_add=True)), 97 | ('quiz', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='taken_quizzes', to='classroom.quiz')), 98 | ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='taken_quizzes', to='classroom.student')), 99 | ], 100 | ), 101 | migrations.CreateModel( 102 | name='StudentAnswer', 103 | fields=[ 104 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 105 | ('answer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='classroom.answer')), 106 | ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='quiz_answers', to='classroom.student')), 107 | ], 108 | ), 109 | migrations.AddField( 110 | model_name='student', 111 | name='quizzes', 112 | field=models.ManyToManyField(through='classroom.TakenQuiz', to='classroom.Quiz'), 113 | ), 114 | ] 115 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/migrations/0002_auditentry.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.9 on 2022-01-16 17:34 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('classroom', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='AuditEntry', 15 | fields=[ 16 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('action', models.CharField(max_length=64)), 18 | ('ip', models.GenericIPAddressField(null=True)), 19 | ('username', models.CharField(max_length=256, null=True)), 20 | ('log_time', models.DateTimeField(auto_now_add=True)), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/china-testing/python_cn_resouce/2eee52f3fa304899d749e7f6f3b613ada87a0ff9/django_examples/django_school/classroom/migrations/__init__.py -------------------------------------------------------------------------------- /django_examples/django_school/classroom/models.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.models import AbstractUser 2 | from django.db import models 3 | from django.utils.html import escape, mark_safe 4 | 5 | 6 | class User(AbstractUser): 7 | is_student = models.BooleanField(default=False) 8 | is_teacher = models.BooleanField(default=False) 9 | 10 | 11 | class Subject(models.Model): 12 | name = models.CharField(max_length=30) 13 | color = models.CharField(max_length=7, default='#007bff') 14 | 15 | def __str__(self): 16 | return self.name 17 | 18 | def get_html_badge(self): 19 | name = escape(self.name) 20 | color = escape(self.color) 21 | html = '%s' % (color, name) 22 | return mark_safe(html) 23 | 24 | 25 | class Quiz(models.Model): 26 | owner = models.ForeignKey(User, on_delete=models.CASCADE, related_name='quizzes') 27 | name = models.CharField(max_length=255) 28 | subject = models.ForeignKey(Subject, on_delete=models.CASCADE, related_name='quizzes') 29 | 30 | def __str__(self): 31 | return self.name 32 | 33 | 34 | class Question(models.Model): 35 | quiz = models.ForeignKey(Quiz, on_delete=models.CASCADE, related_name='questions') 36 | text = models.TextField('Question') 37 | 38 | def __str__(self): 39 | return self.text 40 | 41 | 42 | class Answer(models.Model): 43 | question = models.ForeignKey(Question, on_delete=models.CASCADE, related_name='answers') 44 | text = models.CharField('Answer', max_length=255) 45 | is_correct = models.BooleanField('Correct answer', default=False) 46 | 47 | def __str__(self): 48 | return self.text 49 | 50 | 51 | class Student(models.Model): 52 | user = models.OneToOneField(User, on_delete=models.CASCADE, primary_key=True) 53 | quizzes = models.ManyToManyField(Quiz, through='TakenQuiz') 54 | interests = models.ManyToManyField(Subject, related_name='interested_students') 55 | 56 | # User reputation score. 57 | score = models.IntegerField(default=0) 58 | 59 | def get_unanswered_questions(self, quiz): 60 | answered_questions = self.quiz_answers \ 61 | .filter(answer__question__quiz=quiz) \ 62 | .values_list('answer__question__pk', flat=True) 63 | questions = quiz.questions.exclude(pk__in=answered_questions).order_by('text') 64 | return questions 65 | 66 | def __str__(self): 67 | return self.user.username 68 | 69 | 70 | class TakenQuiz(models.Model): 71 | student = models.ForeignKey(Student, on_delete=models.CASCADE, related_name='taken_quizzes') 72 | quiz = models.ForeignKey(Quiz, on_delete=models.CASCADE, related_name='taken_quizzes') 73 | score = models.IntegerField() 74 | percentage = models.FloatField() 75 | date = models.DateTimeField(auto_now_add=True) 76 | 77 | 78 | class StudentAnswer(models.Model): 79 | student = models.ForeignKey(Student, on_delete=models.CASCADE, related_name='quiz_answers') 80 | answer = models.ForeignKey(Answer, on_delete=models.CASCADE, related_name='+') 81 | 82 | 83 | class AuditEntry(models.Model): 84 | action = models.CharField(max_length=64) 85 | ip = models.GenericIPAddressField(null=True) 86 | username = models.CharField(max_length=256, null=True) 87 | log_time = models.DateTimeField(auto_now_add = True) 88 | 89 | def __str__(self): 90 | return '{0} - {1} - {2}'.format(self.action, self.username, self.ip) 91 | 92 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/signals.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.signals import (user_logged_in, 2 | user_login_failed, user_logged_out) 3 | from django.dispatch import receiver 4 | 5 | from .models import AuditEntry 6 | 7 | # https://stackoverflow.com/a/37620866/2351696 8 | @receiver(user_logged_in) 9 | def user_logged_in_callback(sender, request, user, **kwargs): 10 | ip = request.META.get('REMOTE_ADDR') 11 | AuditEntry.objects.create(action='user_logged_in', ip=ip, username=user.username) 12 | 13 | 14 | @receiver(user_login_failed) 15 | def user_login_failed_callback(sender, credentials, **kwargs): 16 | AuditEntry.objects.create(action='user_login_failed', username=credentials.get('username', None)) 17 | 18 | 19 | @receiver(user_logged_out) 20 | def user_logged_out_callback(sender, request, user, **kwargs): 21 | ip = request.META.get('REMOTE_ADDR') 22 | AuditEntry.objects.create(action='user_logged_out', ip=ip, username=user.username) 23 | 24 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/_guest_header.html: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/about.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block content %} 4 | {% include 'classroom/_guest_header.html' with active='about' %} 5 |

欢迎来到Python测试开发学院!

6 |

技术支持:钉钉或微信pythontesting 7 |

8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/quiz_list.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | {% block css %} 5 | 6 | {% endblock %} 7 | 8 | {% block content %} 9 | {% include 'classroom/_guest_header.html' with active='quizzes' %} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | {% for quiz in quizzes %} 22 | 23 | 24 | 25 | 26 | 29 | 30 | {% empty %} 31 | 32 | 33 | 34 | {% endfor %} 35 | 36 |
测验主题问题数
{{ quiz.name }}{{ quiz.subject.get_html_badge }}{{ quiz.questions_count }} 27 | 开始测试 28 |
No quiz matching your interests right now.
37 | {% endblock %} 38 | 39 | {% block js %} 40 | 41 | 42 | 43 | 48 | {% endblock %} -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/students/_header.html: -------------------------------------------------------------------------------- 1 |

Quizzes

2 | 3 | 4 | 15 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/students/interests_form.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% load crispy_forms_tags %} 4 | 5 | {% block content %} 6 |

更新您的兴趣

7 |
8 | {% csrf_token %} 9 | {{ form|crispy }} 10 | 11 | 忽略 12 |
13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/students/quiz_list.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | {% block css %} 5 | 6 | {% endblock %} 7 | 8 | {% block content %} 9 | {% include 'classroom/students/_header.html' with active='new' %} 10 |

11 | Subjects:{% for subject in user.student.interests.all %} {{ subject.get_html_badge }}{% endfor %} 12 | (update interests) 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | {% for quiz in quizzes %} 26 | 27 | 28 | 29 | 30 | 33 | 34 | {% empty %} 35 | 36 | 37 | 38 | {% endfor %} 39 | 40 |
QuizSubjectQuestions
{{ quiz.name }}{{ quiz.subject.get_html_badge }}{{ quiz.questions_count }} 31 | Start quiz 32 |
No quiz matching your interests right now.
41 | {% endblock %} 42 | 43 | {% block js %} 44 | 45 | 46 | 47 | 52 | {% endblock %} -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/students/quiz_result.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load quiz_extras %} 3 | 4 | {% block content %} 5 | {% include 'classroom/students/_header.html' with active='taken' %} 6 | 12 | 13 | {{ quiz.subject.get_html_badge }} 14 | 15 |
16 |
{{percentage}}%
17 |

18 | {% for question in questions %} 19 |
20 |
21 |
{{forloop.counter}}. {{question.text}}
22 | 23 | 24 | 25 | {% for opt in question.answers.all %} 26 | {% marked_answer user opt as opt_marked %} 27 | 28 | 29 | 30 | 31 | 32 | {% endfor %} 33 | 34 |
YoursCorrect
{{opt.text}}
35 |
36 |
37 |
38 | {% endfor %} 39 | {% endblock %} 40 | 41 | {% block js %} 42 | 43 | 44 | {% endblock %} -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/students/student_detail.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | {% load quiz_extras %} 4 | 5 | {% block content %} 6 | {% if request.user.is_authenticated %} 7 | {% include 'classroom/students/_header.html' with active='students' %} 8 | {% else %} 9 | {% include 'classroom/_guest_header.html' with active='students' %} 10 | {% endif %} 11 | 17 |
18 |
19 | @{{ student.user.email}} 20 |
21 |
22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Email{{student.user.email}}
用户{{student.user.username}}
全名{{student.user.get_full_name}}
分数{{student.score}}
32 |
33 |
34 |

35 |

Top Subjects

36 | {% for subject in subjects %} 37 | 38 | {{subject.quiz__subject__name}} 39 | x {{subject.score}} 40 | {% endfor %} 41 | {% endblock %} 42 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/students/student_list.html: -------------------------------------------------------------------------------- 1 | 2 | {% extends 'base.html' %} 3 | {% load quiz_extras %} 4 | 5 | {% block css %} 6 | 11 | {% endblock %} 12 | 13 | {% block content %} 14 | {% if request.user.is_active %} 15 | {% include 'classroom/students/_header.html' with active='students' %} 16 | {% else %} 17 | {% include 'classroom/_guest_header.html' with active='students' %} 18 | {% endif %} 19 |
20 |
21 |
22 |
23 | 24 |
25 | 26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | {% for student in students %} 34 |
35 |
36 | 37 | {{student.user.get_full_name}} 38 | 39 |
40 | 41 | {{student.user.username}}
42 | {{student.score}}
43 | {{student.taken_quizzes.all|top_subject}} 44 |
45 |
46 |
47 | {% empty %} 48 |

No student matched your search.

49 | {% endfor %} 50 |
51 | 52 | {% if is_paginated %} 53 | 72 | {% endif %} 73 | {% endblock %} -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/students/take_quiz_form.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% load crispy_forms_tags %} 4 | 5 | {% block css %} 6 | 32 | {% endblock %} 33 | 34 | {% block content %} 35 |
36 |
37 |
38 |

{{ answered_questions|add:"1" }}/{{total_questions}}

39 | 40 |

{{ quiz.name }}

41 |

{{ question.text }}

42 |
43 | {% csrf_token %} 44 | {{ form|crispy }} 45 | 46 |
47 | {% endblock %} 48 | 49 | {% block js %} 50 | 51 | 52 | {% endblock %} -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/students/taken_quiz_list.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block content %} 4 | {% include 'classroom/students/_header.html' with active='taken' %} 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | {% for taken_quiz in taken_quizzes %} 16 | 17 | 18 | 19 | 20 | 21 | {% empty %} 22 | 23 | 24 | 25 | {% endfor %} 26 | 27 |
QuizSubject%
{{ taken_quiz.quiz.name }}{{ taken_quiz.quiz.subject.get_html_badge }}{{ taken_quiz.percentage }}
You haven't completed any quiz yet.
28 |
29 | {% endblock %} 30 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/teachers/question_add_form.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% load crispy_forms_tags %} 4 | 5 | {% block content %} 6 | 13 |

Add a new question

14 |

Add first the text of the question. In the next step you will be able to add the possible answers.

15 |
16 | {% csrf_token %} 17 | {{ form|crispy }} 18 | 19 | Nevermind 20 |
21 | {% endblock %} 22 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/teachers/question_change_form.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% load crispy_forms_tags crispy_forms_filters %} 4 | 5 | {% block content %} 6 | 13 |

{{ question.txt }}

14 |
15 | {% csrf_token %} 16 | {{ formset.management_form }} 17 | {{ form|crispy }} 18 |
19 |
20 |
21 |
22 | Answers 23 |
24 |
25 | Correct? 26 |
27 |
28 | Delete? 29 |
30 |
31 |
32 | {% for error in formset.non_form_errors %} 33 |
{{ error }}
34 | {% endfor %} 35 |
36 | {% for form in formset %} 37 |
38 |
39 |
40 | {% for hidden in form.hidden_fields %}{{ hidden }}{% endfor %} 41 | {{ form.text|as_crispy_field }} 42 | {% if form.instance.pk and form.text.value != form.instance.text %}

Old answer: {{ form.instance.text }}

{% endif %} 43 |
44 |
45 | {{ form.is_correct }} 46 |
47 |
48 | {% if form.instance.pk %} 49 | {{ form.DELETE }} 50 | {% endif %} 51 |
52 |
53 |
54 | {% endfor %} 55 |
56 |
57 |

58 | Your question may have at least 2 answers and maximum 10 answers. Select at least one correct answer. 59 |

60 | 61 | Nevermind 62 | Delete 63 |
64 | {% endblock %} 65 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/teachers/question_delete_confirm.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% load crispy_forms_tags %} 4 | 5 | {% block content %} 6 | 14 |

Confirm deletion

15 |

Are you sure you want to delete the question "{{ question.text }}"? There is no going back.

16 |
17 | {% csrf_token %} 18 | 19 | Nevermind 20 |
21 | {% endblock %} 22 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/teachers/question_preview.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block content %} 4 | 10 |

Question Preview

11 | 12 |
13 |
14 | {{question.text}} 15 |
16 | 22 |
23 | {% endblock %} 24 | 25 | {% block js %} 26 | 27 | 28 | {% endblock %} -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/teachers/quiz_add_form.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% load crispy_forms_tags %} 4 | 5 | {% block content %} 6 | 12 |

Add a new quiz

13 |
14 |
15 |
16 | {% csrf_token %} 17 | {{ form|crispy }} 18 | 19 | Nevermind 20 |
21 |
22 |
23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/teachers/quiz_change_form.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% load crispy_forms_tags %} 4 | 5 | {% block content %} 6 | 12 |

13 | {{ quiz.name }} 14 | View results 15 |

16 |
17 |
18 |
19 | {% csrf_token %} 20 | {{ form|crispy }} 21 | 22 | Nevermind 23 | Delete 24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | Questions + 32 |
33 |
34 | Answers 35 |
36 |
37 |
38 |
39 | {% for question in questions %} 40 |
41 |
42 |
43 | {{ question.text }} 44 | preview 45 |
46 |
47 | {{ question.answers_count }} 48 |
49 |
50 |
51 | {% empty %} 52 |
53 |

You haven't created any questions yet. Go ahead and add the first question.

54 |
55 | {% endfor %} 56 |
57 | 60 |
61 | {% endblock %} 62 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/teachers/quiz_change_list.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block content %} 4 | 9 |

My Quizzes

10 | Add quiz 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | {% for quiz in quizzes %} 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | {% empty %} 34 | 35 | 36 | 37 | {% endfor %} 38 | 39 |
QuizSubjectQuestionsTaken
{{ quiz.name }}{{ quiz.subject.get_html_badge }}{{ quiz.questions_count }}{{ quiz.taken_count }} 30 | View results 31 |
You haven't created any quiz yet.
40 |
41 | {% endblock %} 42 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/teachers/quiz_delete_confirm.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% load crispy_forms_tags %} 4 | 5 | {% block content %} 6 | 13 |

Confirm deletion

14 |

Are you sure you want to delete the quiz "{{ quiz.name }}"? There is no going back.

15 |
16 | {% csrf_token %} 17 | 18 | Nevermind 19 |
20 | {% endblock %} 21 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templates/classroom/teachers/quiz_results.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% load crispy_forms_tags humanize %} 4 | 5 | {% block content %} 6 | 13 |

{{ quiz.name }} Results

14 |

Total Questions: {{total_questions}}

15 |
16 |
17 | Taken Quizzes 18 | Average Score: {{ quiz_score.average_score|default_if_none:0.0|floatformat:2 }} 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | {% for taken_quiz in taken_quizzes %} 31 | 32 | 33 | 34 | 35 | 36 | 37 | {% endfor %} 38 | 39 |
StudentDateScorePercentage
{{ taken_quiz.student.user.username }}{{ taken_quiz.date|naturaltime }}{{ taken_quiz.score }}{{ taken_quiz.percentage }}
40 | 43 |
44 | {% endblock %} 45 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templatetags/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/china-testing/python_cn_resouce/2eee52f3fa304899d749e7f6f3b613ada87a0ff9/django_examples/django_school/classroom/templatetags/__init__.py -------------------------------------------------------------------------------- /django_examples/django_school/classroom/templatetags/quiz_extras.py: -------------------------------------------------------------------------------- 1 | from django import template 2 | from django.db.models import Sum 3 | 4 | from classroom.models import StudentAnswer 5 | import hashlib 6 | 7 | register = template.Library() 8 | 9 | @register.simple_tag 10 | def marked_answer(user,opt): 11 | studentanswer = StudentAnswer.objects.filter(student=user.student, answer =opt) 12 | if studentanswer: 13 | if opt.is_correct: 14 | return 'correct' 15 | return 'wrong' 16 | return '' 17 | 18 | @register.filter 19 | def gravatar_url(username, size=40): 20 | # TEMPLATE USE: {{ email|gravatar_url:150 }} 21 | username_hash = hashlib.md5(username.lower().encode('utf-8')).hexdigest() 22 | return f"https://www.gravatar.com/avatar/{username_hash}?s={size}&d=identicon" 23 | 24 | @register.filter 25 | def top_subject(taken_quizzes): 26 | subjects = taken_quizzes.values('quiz__subject__name') \ 27 | .annotate(score = Sum('score')) \ 28 | .order_by('-score') 29 | if subjects: 30 | name = subjects[0]['quiz__subject__name'] 31 | score = subjects[0]['score'] 32 | return f"{name} x {score}" 33 | return "" -------------------------------------------------------------------------------- /django_examples/django_school/classroom/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase, Client 2 | 3 | from django.urls import reverse 4 | from django.template import Template, Context 5 | 6 | 7 | from classroom.models import Student 8 | 9 | class LoginPageTest(TestCase): 10 | fixtures = ["datas.json"] 11 | 12 | def setUp(self): 13 | self.client = Client() 14 | self.student = Student.objects.get(user__username = 'student') 15 | 16 | self.home_url = reverse('home') 17 | self.student_list_url = reverse('students:student_list') 18 | self.about_url = reverse('about') 19 | 20 | self.tabs = f''' 21 | ''' 26 | 27 | self.tabs = lambda active_tab='': f''' 28 | ''' 33 | 34 | def test_login_page_returns_correct_html(self): 35 | loginurl = reverse('login') 36 | response = self.client.get(loginurl) 37 | self.assertEqual(response.status_code,200) 38 | # test response contains Username and Password 39 | self.assertIn(b'Username', response.content) 40 | self.assertIn(b'Password', response.content) 41 | 42 | # blank fields 43 | response = self.client.post(loginurl) 44 | self.assertIn(b'This field is required.', response.content) 45 | 46 | # wrong username or password 47 | response = self.client.post(loginurl, {'username':'bad', 'password':'bad'}) 48 | self.assertIn(b'Please enter a correct username and password.', response.content) 49 | 50 | def test_login_as_teacher(self): 51 | loginurl = reverse('login') 52 | # login as teacher 53 | response = self.client.post(loginurl, {'username':'sumee', 'password':'sumee1910'}, follow=True) 54 | # print(response.redirect_chain) 55 | # self.assertEqual(response.redirect_chain[1][0],reverse('teachers:quiz_change_list')) 56 | # self.assertIn(b'My Quizzes', response.content) 57 | 58 | def test_guest_user_can_access_quiz_list(self): 59 | response = self.client.get(self.home_url) 60 | 61 | # there is tab view in homepage and check there is quiz list url in home page 62 | self.assertInHTML(self.tabs('home'), response.content.decode()) 63 | 64 | quiz1 = ''' 65 | World War 1 66 | History 67 | 4 68 | 69 | Start quiz 70 | 71 | 72 | ''' 73 | self.assertInHTML(quiz1, response.content.decode()) 74 | 75 | def test_guest_user_can_access_student_list(self): 76 | 77 | # there is tab view in homepage and check there is student list url in home page 78 | response = self.client.get(self.student_list_url) 79 | self.assertInHTML(self.tabs('students'), response.content.decode()) 80 | 81 | # guest user can access student list 82 | student_search_form = ''' 83 |
84 |
85 |
86 |
87 | 88 |
89 | 90 |
91 |
92 |
93 |
94 |
95 | ''' 96 | self.assertInHTML(student_search_form, response.content.decode()) 97 | 98 | 99 | # test students listed in the page 100 | student_detail_url = reverse('students:student_detail', kwargs={'student':self.student.pk}) 101 | 102 | 103 | gravatar_url = Template(''' 104 | {% load quiz_extras %} 105 | {{student.user.get_full_name}} 106 | ''').render(Context({'student':self.student})) 107 | 108 | student_info = f''' 109 |
110 |
111 | {gravatar_url} 112 |
113 | {self.student.user.username}
114 | 0
115 |
116 |
117 | ''' 118 | self.assertInHTML(student_info, response.content.decode()) 119 | 120 | def test_guest_user_can_access_student_detail(self): 121 | 122 | student_detail_url = reverse('students:student_detail', kwargs={'student':self.student.pk}) 123 | response = self.client.get(student_detail_url) 124 | 125 | self.assertInHTML(self.tabs('students'), response.content.decode()) 126 | 127 | breadcrumb = f''' 128 | 134 | ''' 135 | # breadcrumb in student details page 136 | self.assertInHTML(breadcrumb, response.content.decode()) 137 | 138 | 139 | def test_login_and_signup_page_contains_navbar(self): 140 | # check tabs in login page 141 | response = self.client.get(reverse('login')) 142 | self.assertInHTML(self.tabs(), response.content.decode()) 143 | 144 | # check tabs in signup page 145 | response = self.client.get(reverse('signup')) 146 | self.assertInHTML(self.tabs(), response.content.decode()) 147 | 148 | # check tabs in student_signup page 149 | # response = self.client.get(reverse('student_signup')) 150 | # self.assertInHTML(self.tabs(), response.content.decode()) 151 | 152 | # check tabs in teacher_signup page 153 | response = self.client.get(reverse('teacher_signup')) 154 | self.assertInHTML(self.tabs(), response.content.decode()) 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import include, path 2 | 3 | from .views import classroom, students, teachers 4 | 5 | urlpatterns = [ 6 | path('', classroom.home, name='home'), 7 | path('about/', classroom.AboutView.as_view(), name='about'), 8 | # path('quizzes/', classroom.QuizListView.as_view(), name='quiz_list'), 9 | 10 | path('students/', include(([ 11 | path('', students.StudentList.as_view(), name='student_list'), 12 | path('/', students.StudentDetail.as_view(), name='student_detail'), 13 | path('interests/', students.StudentInterestsView.as_view(), name='student_interests'), 14 | path('taken/', students.TakenQuizListView.as_view(), name='taken_quiz_list'), 15 | path('quiz/', students.QuizListView.as_view(), name='quiz_list'), 16 | path('quiz//', students.take_quiz, name='take_quiz'), 17 | path('quiz//studentresults/', students.QuizResultsView.as_view(), name='student_quiz_results'), 18 | ], 'classroom'), namespace='students')), 19 | path('teachers/', include(([ 20 | path('', teachers.QuizListView.as_view(), name='quiz_change_list'), 21 | path('quiz/add/', teachers.QuizCreateView.as_view(), name='quiz_add'), 22 | path('quiz//', teachers.QuizUpdateView.as_view(), name='quiz_change'), 23 | path('quiz//delete/', teachers.QuizDeleteView.as_view(), name='quiz_delete'), 24 | path('quiz//results/', teachers.QuizResultsView.as_view(), name='quiz_results'), 25 | path('quiz//question/add/', teachers.question_add, name='question_add'), 26 | path('quiz//question//', teachers.question_change, name='question_change'), 27 | path('quiz//question//preview/', teachers.QuestionPreviewView.as_view(), name='question_preview'), 28 | path('quiz//question//delete/', teachers.QuestionDeleteView.as_view(), name='question_delete'), 29 | ], 'classroom'), namespace='teachers')), 30 | ] 31 | -------------------------------------------------------------------------------- /django_examples/django_school/classroom/views/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/china-testing/python_cn_resouce/2eee52f3fa304899d749e7f6f3b613ada87a0ff9/django_examples/django_school/classroom/views/__init__.py -------------------------------------------------------------------------------- /django_examples/django_school/classroom/views/classroom.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import redirect, render 2 | from django.views.generic import TemplateView 3 | from django.db.models import Count 4 | 5 | from classroom.models import Quiz 6 | 7 | def home(request): 8 | if request.user.is_authenticated: 9 | if request.user.is_teacher: 10 | return redirect('teachers:quiz_change_list') 11 | elif request.user.is_student: 12 | return redirect('students:quiz_list') 13 | else: 14 | return redirect('admin:index') 15 | return render(request,'classroom/quiz_list.html',{ 16 | 'quizzes':Quiz.objects.annotate(questions_count=Count('questions')) \ 17 | .filter(questions_count__gt=0)}) 18 | 19 | 20 | class AboutView(TemplateView): 21 | template_name = 'classroom/about.html' -------------------------------------------------------------------------------- /django_examples/django_school/classroom/views/students.py: -------------------------------------------------------------------------------- 1 | from django.contrib import messages 2 | from django.contrib.auth import login 3 | from django.contrib.auth.decorators import login_required 4 | from django.contrib.auth import get_user_model 5 | 6 | from django.db import transaction 7 | from django.db.models import Count, Sum 8 | from django.db.models.functions import Concat 9 | from django.shortcuts import get_object_or_404, redirect, render 10 | from django.urls import reverse_lazy 11 | from django.utils.decorators import method_decorator 12 | from django.views.generic import CreateView, ListView, UpdateView 13 | from django.views import View 14 | 15 | from ..decorators import student_required 16 | from ..forms import StudentInterestsForm, StudentSignUpForm, TakeQuizForm 17 | from ..models import Quiz, Student, TakenQuiz, Question 18 | 19 | User = get_user_model() 20 | 21 | class StudentSignUpView(CreateView): 22 | model = User 23 | form_class = StudentSignUpForm 24 | template_name = 'registration/signup_form.html' 25 | 26 | def get_context_data(self, **kwargs): 27 | kwargs['user_type'] = 'student' 28 | return super().get_context_data(**kwargs) 29 | 30 | def form_valid(self, form): 31 | user = form.save() 32 | login(self.request, user, backend='django.contrib.auth.backends.ModelBackend') 33 | return redirect('students:quiz_list') 34 | 35 | 36 | @method_decorator([login_required, student_required], name='dispatch') 37 | class StudentInterestsView(UpdateView): 38 | model = Student 39 | form_class = StudentInterestsForm 40 | template_name = 'classroom/students/interests_form.html' 41 | success_url = reverse_lazy('students:quiz_list') 42 | 43 | def get_object(self): 44 | return self.request.user.student 45 | 46 | def form_valid(self, form): 47 | messages.success(self.request, 'Interests updated with success!') 48 | return super().form_valid(form) 49 | 50 | 51 | @method_decorator([login_required, student_required], name='dispatch') 52 | class QuizListView(ListView): 53 | model = Quiz 54 | ordering = ('name', ) 55 | context_object_name = 'quizzes' 56 | template_name = 'classroom/students/quiz_list.html' 57 | 58 | def get_queryset(self): 59 | student = self.request.user.student 60 | # student_interests = student.interests.values_list('pk', flat=True) 61 | taken_quizzes = student.quizzes.values_list('pk', flat=True) 62 | queryset = Quiz.objects.exclude(pk__in=taken_quizzes) \ 63 | .annotate(questions_count=Count('questions')) \ 64 | .filter(questions_count__gt=0) 65 | return queryset 66 | 67 | def get_context_data(self, **kwargs): 68 | context = super().get_context_data(**kwargs) 69 | context['student_subjects'] = self.request.user.student.interests.values_list('pk', flat=True) 70 | return context 71 | 72 | @method_decorator([login_required, student_required], name='dispatch') 73 | class QuizResultsView(View): 74 | template_name = 'classroom/students/quiz_result.html' 75 | 76 | def get(self, request, *args, **kwargs): 77 | quiz = Quiz.objects.get(id = kwargs['pk']) 78 | taken_quiz = TakenQuiz.objects.filter(student = request.user.student, quiz = quiz) 79 | if not taken_quiz: 80 | """ 81 | Don't show the result if the user didn't attempted the quiz 82 | """ 83 | return render(request, '404.html') 84 | questions = Question.objects.filter(quiz =quiz) 85 | 86 | # questions = self.form_class(initial=self.initial) 87 | return render(request, self.template_name, {'questions':questions, 88 | 'quiz':quiz, 'percentage': taken_quiz[0].percentage}) 89 | 90 | 91 | @method_decorator([login_required, student_required], name='dispatch') 92 | class TakenQuizListView(ListView): 93 | model = TakenQuiz 94 | context_object_name = 'taken_quizzes' 95 | template_name = 'classroom/students/taken_quiz_list.html' 96 | 97 | def get_queryset(self): 98 | queryset = self.request.user.student.taken_quizzes \ 99 | .select_related('quiz', 'quiz__subject') \ 100 | .order_by('quiz__name') 101 | return queryset 102 | 103 | 104 | @login_required 105 | @student_required 106 | def take_quiz(request, pk): 107 | quiz = get_object_or_404(Quiz, pk=pk) 108 | student = request.user.student 109 | 110 | if student.quizzes.filter(pk=pk).exists(): 111 | return render(request, 'students/taken_quiz.html') 112 | 113 | total_questions = quiz.questions.count() 114 | unanswered_questions = student.get_unanswered_questions(quiz) 115 | total_unanswered_questions = unanswered_questions.count() 116 | progress = 100 - round(((total_unanswered_questions - 1) / total_questions) * 100) 117 | question = unanswered_questions.first() 118 | 119 | if request.method == 'POST': 120 | form = TakeQuizForm(question=question, data=request.POST) 121 | if form.is_valid(): 122 | with transaction.atomic(): 123 | student_answer = form.save(commit=False) 124 | student_answer.student = student 125 | student_answer.save() 126 | if student.get_unanswered_questions(quiz).exists(): 127 | return redirect('students:take_quiz', pk) 128 | else: 129 | correct_answers = student.quiz_answers.filter(answer__question__quiz=quiz, answer__is_correct=True).count() 130 | percentage = round((correct_answers / total_questions) * 100.0, 2) 131 | TakenQuiz.objects.create(student=student, quiz=quiz, score=correct_answers, percentage= percentage) 132 | student.score = TakenQuiz.objects.filter(student=student).aggregate(Sum('score'))['score__sum'] 133 | student.save() 134 | if percentage < 50.0: 135 | messages.warning(request, 'Better luck next time! Your score for the quiz %s was %s.' % (quiz.name, percentage)) 136 | else: 137 | messages.success(request, 'Congratulations! You completed the quiz %s with success! You scored %s points.' % (quiz.name, percentage)) 138 | # return redirect('students:quiz_list') 139 | return redirect('students:student_quiz_results', pk) 140 | else: 141 | form = TakeQuizForm(question=question) 142 | 143 | return render(request, 'classroom/students/take_quiz_form.html', { 144 | 'quiz': quiz, 145 | 'question': question, 146 | 'form': form, 147 | 'progress': progress, 148 | 'answered_questions': total_questions - total_unanswered_questions, 149 | 'total_questions': total_questions 150 | }) 151 | 152 | 153 | 154 | class StudentList(ListView): 155 | paginate_by = 36 156 | template_name = 'classroom/students/student_list.html' 157 | context_object_name = 'students' 158 | 159 | def get_queryset(self): 160 | query = self.request.GET.get('q','') 161 | User = get_user_model() 162 | 163 | queryset = Student.objects.order_by('-score') 164 | if query: 165 | queryset = queryset.filter(user__username__icontains = query) 166 | return queryset 167 | 168 | 169 | class StudentDetail(View): 170 | """Show Details of a Student""" 171 | def get(self, request, **kwargs): 172 | student = Student.objects.get(user_id = kwargs['student']) 173 | subjects = student.taken_quizzes.all() \ 174 | .values('quiz__subject__name','quiz__subject__color') \ 175 | .annotate(score = Sum('score')) \ 176 | .order_by('-score') 177 | 178 | return render(request,'classroom/students/student_detail.html', 179 | {'student': student, 'subjects':subjects}) -------------------------------------------------------------------------------- /django_examples/django_school/classroom/views/teachers.py: -------------------------------------------------------------------------------- 1 | from django.contrib import messages 2 | from django.contrib.auth import login 3 | from django.contrib.auth.decorators import login_required 4 | from django.contrib.auth import get_user_model 5 | 6 | from django.db import transaction 7 | from django.db.models import Avg, Count 8 | from django.forms import inlineformset_factory 9 | from django.shortcuts import get_object_or_404, redirect, render 10 | from django.urls import reverse, reverse_lazy 11 | from django.utils.decorators import method_decorator 12 | from django.views.generic import (CreateView, DeleteView, DetailView, ListView, 13 | UpdateView) 14 | 15 | from ..decorators import teacher_required 16 | from ..forms import BaseAnswerInlineFormSet, QuestionForm, TeacherSignUpForm 17 | from ..models import Answer, Question, Quiz 18 | 19 | User = get_user_model() 20 | 21 | class TeacherSignUpView(CreateView): 22 | model = User 23 | form_class = TeacherSignUpForm 24 | template_name = 'registration/signup_form.html' 25 | 26 | def get_context_data(self, **kwargs): 27 | kwargs['user_type'] = 'teacher' 28 | return super().get_context_data(**kwargs) 29 | 30 | def form_valid(self, form): 31 | user = form.save() 32 | login(self.request, user, backend='django.contrib.auth.backends.ModelBackend') 33 | return redirect('teachers:quiz_change_list') 34 | 35 | 36 | @method_decorator([login_required, teacher_required], name='dispatch') 37 | class QuizListView(ListView): 38 | model = Quiz 39 | ordering = ('name', ) 40 | context_object_name = 'quizzes' 41 | template_name = 'classroom/teachers/quiz_change_list.html' 42 | 43 | def get_queryset(self): 44 | queryset = self.request.user.quizzes \ 45 | .select_related('subject') \ 46 | .annotate(questions_count=Count('questions', distinct=True)) \ 47 | .annotate(taken_count=Count('taken_quizzes', distinct=True)) 48 | return queryset 49 | 50 | 51 | @method_decorator([login_required, teacher_required], name='dispatch') 52 | class QuizCreateView(CreateView): 53 | model = Quiz 54 | fields = ('name', 'subject', ) 55 | template_name = 'classroom/teachers/quiz_add_form.html' 56 | 57 | def form_valid(self, form): 58 | quiz = form.save(commit=False) 59 | quiz.owner = self.request.user 60 | quiz.save() 61 | messages.success(self.request, 'The quiz was created with success! Go ahead and add some questions now.') 62 | return redirect('teachers:quiz_change', quiz.pk) 63 | 64 | 65 | @method_decorator([login_required, teacher_required], name='dispatch') 66 | class QuizUpdateView(UpdateView): 67 | model = Quiz 68 | fields = ('name', 'subject', ) 69 | context_object_name = 'quiz' 70 | template_name = 'classroom/teachers/quiz_change_form.html' 71 | 72 | def get_context_data(self, **kwargs): 73 | kwargs['questions'] = self.get_object().questions.annotate(answers_count=Count('answers')) 74 | return super().get_context_data(**kwargs) 75 | 76 | def get_queryset(self): 77 | ''' 78 | This method is an implicit object-level permission management 79 | This view will only match the ids of existing quizzes that belongs 80 | to the logged in user. 81 | ''' 82 | return self.request.user.quizzes.all() 83 | 84 | def get_success_url(self): 85 | return reverse('teachers:quiz_change', kwargs={'pk': self.object.pk}) 86 | 87 | 88 | @method_decorator([login_required, teacher_required], name='dispatch') 89 | class QuizDeleteView(DeleteView): 90 | model = Quiz 91 | context_object_name = 'quiz' 92 | template_name = 'classroom/teachers/quiz_delete_confirm.html' 93 | success_url = reverse_lazy('teachers:quiz_change_list') 94 | 95 | def delete(self, request, *args, **kwargs): 96 | quiz = self.get_object() 97 | messages.success(request, 'The quiz %s was deleted with success!' % quiz.name) 98 | return super().delete(request, *args, **kwargs) 99 | 100 | def get_queryset(self): 101 | return self.request.user.quizzes.all() 102 | 103 | 104 | @method_decorator([login_required, teacher_required], name='dispatch') 105 | class QuizResultsView(DetailView): 106 | model = Quiz 107 | context_object_name = 'quiz' 108 | template_name = 'classroom/teachers/quiz_results.html' 109 | 110 | def get_context_data(self, **kwargs): 111 | quiz = self.get_object() 112 | taken_quizzes = quiz.taken_quizzes.select_related('student__user').order_by('-date') 113 | total_taken_quizzes = taken_quizzes.count() 114 | quiz_score = quiz.taken_quizzes.aggregate(average_score=Avg('score')) 115 | extra_context = { 116 | 'taken_quizzes': taken_quizzes, 117 | 'total_taken_quizzes': total_taken_quizzes, 118 | 'quiz_score': quiz_score, 119 | 'total_questions':quiz.questions.count() 120 | } 121 | kwargs.update(extra_context) 122 | return super().get_context_data(**kwargs) 123 | 124 | def get_queryset(self): 125 | return self.request.user.quizzes.all() 126 | 127 | 128 | @login_required 129 | @teacher_required 130 | def question_add(request, pk): 131 | # By filtering the quiz by the url keyword argument `pk` and 132 | # by the owner, which is the logged in user, we are protecting 133 | # this view at the object-level. Meaning only the owner of 134 | # quiz will be able to add questions to it. 135 | quiz = get_object_or_404(Quiz, pk=pk, owner=request.user) 136 | 137 | if request.method == 'POST': 138 | form = QuestionForm(request.POST) 139 | if form.is_valid(): 140 | question = form.save(commit=False) 141 | question.quiz = quiz 142 | question.save() 143 | messages.success(request, 'You may now add answers/options to the question.') 144 | return redirect('teachers:question_change', quiz.pk, question.pk) 145 | else: 146 | form = QuestionForm() 147 | 148 | return render(request, 'classroom/teachers/question_add_form.html', {'quiz': quiz, 'form': form}) 149 | 150 | 151 | @login_required 152 | @teacher_required 153 | def question_change(request, quiz_pk, question_pk): 154 | # Simlar to the `question_add` view, this view is also managing 155 | # the permissions at object-level. By querying both `quiz` and 156 | # `question` we are making sure only the owner of the quiz can 157 | # change its details and also only questions that belongs to this 158 | # specific quiz can be changed via this url (in cases where the 159 | # user might have forged/player with the url params. 160 | quiz = get_object_or_404(Quiz, pk=quiz_pk, owner=request.user) 161 | question = get_object_or_404(Question, pk=question_pk, quiz=quiz) 162 | 163 | AnswerFormSet = inlineformset_factory( 164 | Question, # parent model 165 | Answer, # base model 166 | formset=BaseAnswerInlineFormSet, 167 | fields=('text', 'is_correct'), 168 | min_num=2, 169 | validate_min=True, 170 | max_num=10, 171 | validate_max=True 172 | ) 173 | 174 | if request.method == 'POST': 175 | form = QuestionForm(request.POST, instance=question) 176 | formset = AnswerFormSet(request.POST, instance=question) 177 | if form.is_valid() and formset.is_valid(): 178 | with transaction.atomic(): 179 | form.save() 180 | formset.save() 181 | messages.success(request, 'Question and answers saved with success!') 182 | return redirect('teachers:quiz_change', quiz.pk) 183 | else: 184 | form = QuestionForm(instance=question) 185 | formset = AnswerFormSet(instance=question) 186 | 187 | return render(request, 'classroom/teachers/question_change_form.html', { 188 | 'quiz': quiz, 189 | 'question': question, 190 | 'form': form, 191 | 'formset': formset 192 | }) 193 | 194 | 195 | @method_decorator([login_required, teacher_required], name='dispatch') 196 | class QuestionDeleteView(DeleteView): 197 | model = Question 198 | context_object_name = 'question' 199 | template_name = 'classroom/teachers/question_delete_confirm.html' 200 | pk_url_kwarg = 'question_pk' 201 | 202 | def get_context_data(self, **kwargs): 203 | question = self.get_object() 204 | kwargs['quiz'] = question.quiz 205 | return super().get_context_data(**kwargs) 206 | 207 | def delete(self, request, *args, **kwargs): 208 | question = self.get_object() 209 | messages.success(request, 'The question %s was deleted with success!' % question.text) 210 | return super().delete(request, *args, **kwargs) 211 | 212 | def get_queryset(self): 213 | return Question.objects.filter(quiz__owner=self.request.user) 214 | 215 | def get_success_url(self): 216 | question = self.get_object() 217 | return reverse('teachers:quiz_change', kwargs={'pk': question.quiz_id}) 218 | 219 | @method_decorator([login_required, teacher_required], name='dispatch') 220 | class QuestionPreviewView(DetailView): 221 | model = Question 222 | template_name = 'classroom/teachers/question_preview.html' 223 | pk_url_kwarg = 'question_pk' 224 | 225 | def get_context_data(self, **kwargs): 226 | question = self.get_object() 227 | kwargs['quiz'] = question.quiz 228 | return super().get_context_data(**kwargs) 229 | 230 | def get_queryset(self): 231 | return Question.objects.filter(quiz__owner=self.request.user) -------------------------------------------------------------------------------- /django_examples/django_school/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/china-testing/python_cn_resouce/2eee52f3fa304899d749e7f6f3b613ada87a0ff9/django_examples/django_school/mysite/__init__.py -------------------------------------------------------------------------------- /django_examples/django_school/mysite/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for mysite project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/humans.txt: -------------------------------------------------------------------------------- 1 | temp -------------------------------------------------------------------------------- /django_examples/django_school/mysite/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for mysite project. 3 | 4 | Generated by 'django-admin startproject' using Django 4.0.1. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/4.0/ref/settings/ 11 | """ 12 | 13 | from pathlib import Path 14 | from decouple import config 15 | from django.contrib.messages import constants as messages 16 | 17 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 18 | BASE_DIR = Path(__file__).resolve().parent.parent 19 | 20 | 21 | # Quick-start development settings - unsuitable for production 22 | # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ 23 | 24 | # SECURITY WARNING: keep the secret key used in production secret! 25 | SECRET_KEY = "abcd" # https://stackoverflow.com/a/53144229/2351696 26 | 27 | # SECURITY WARNING: don't run with debug turned on in production! 28 | DEBUG = True 29 | 30 | 31 | ALLOWED_HOSTS = ['*'] 32 | 33 | 34 | # Application definition 35 | 36 | INSTALLED_APPS = [ 37 | 'django.contrib.auth', 38 | 'django.contrib.admin', 39 | 'django.contrib.contenttypes', 40 | 'django.contrib.sessions', 41 | 'django.contrib.messages', 42 | 'django.contrib.staticfiles', 43 | 'django.contrib.humanize', 44 | 45 | 'crispy_forms', 46 | 'classroom', 47 | ] 48 | 49 | MIDDLEWARE = [ 50 | 'django.middleware.security.SecurityMiddleware', 51 | 'whitenoise.middleware.WhiteNoiseMiddleware', 52 | 'django.contrib.sessions.middleware.SessionMiddleware', 53 | 'django.middleware.common.CommonMiddleware', 54 | 'django.middleware.csrf.CsrfViewMiddleware', 55 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 56 | 'django.contrib.messages.middleware.MessageMiddleware', 57 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 58 | 59 | ] 60 | 61 | 62 | ROOT_URLCONF = 'mysite.urls' 63 | 64 | TEMPLATES = [ 65 | { 66 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 67 | 'DIRS': [ 68 | BASE_DIR / 'mysite' / 'templates', 69 | ], 70 | 'APP_DIRS': True, 71 | 'OPTIONS': { 72 | 'context_processors': [ 73 | 'django.template.context_processors.debug', 74 | 'django.template.context_processors.request', 75 | 'django.contrib.auth.context_processors.auth', 76 | 'django.contrib.messages.context_processors.messages', 77 | ], 78 | }, 79 | }, 80 | ] 81 | 82 | WSGI_APPLICATION = 'mysite.wsgi.application' 83 | 84 | 85 | # Database 86 | # https://docs.djangoproject.com/en/4.0/ref/settings/#databases 87 | 88 | DATABASES = { 89 | 'default': { 90 | 'ENGINE': 'django.db.backends.sqlite3', 91 | 'NAME': BASE_DIR / 'db.sqlite3', 92 | } 93 | } 94 | 95 | 96 | 97 | 98 | # Internationalization 99 | # https://docs.djangoproject.com/en/4.0/topics/i18n/ 100 | 101 | LANGUAGE_CODE = 'en-us' 102 | 103 | TIME_ZONE = 'UTC' 104 | 105 | USE_I18N = True 106 | 107 | USE_TZ = True 108 | 109 | 110 | # Static files (CSS, JavaScript, Images) 111 | # https://docs.djangoproject.com/en/4.0/howto/static-files/ 112 | 113 | STATIC_URL = 'static/' 114 | 115 | # Default primary key field type 116 | # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field 117 | 118 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 119 | 120 | # custom 121 | 122 | STATIC_ROOT = BASE_DIR / 'mysite' / 'staticfiles' 123 | STATICFILES_DIRS = [ 124 | BASE_DIR / 'mysite' / 'static', 125 | ] 126 | 127 | 128 | AUTHENTICATION_BACKENDS = [ 129 | # 'social_core.backends.twitter.TwitterOAuth', 130 | # 'social_core.backends.facebook.FacebookOAuth2', 131 | 132 | 'django.contrib.auth.backends.ModelBackend', 133 | ] 134 | 135 | # Custom Django auth settings 136 | AUTH_USER_MODEL = 'classroom.User' 137 | 138 | LOGIN_URL = 'login' 139 | LOGOUT_URL = 'logout' 140 | LOGIN_REDIRECT_URL = 'home' 141 | LOGOUT_REDIRECT_URL = 'home' 142 | 143 | 144 | # Messages built-in framework 145 | MESSAGE_TAGS = { 146 | messages.DEBUG: 'alert-secondary', 147 | messages.INFO: 'alert-info', 148 | messages.SUCCESS: 'alert-success', 149 | messages.WARNING: 'alert-warning', 150 | messages.ERROR: 'alert-danger', 151 | } 152 | 153 | 154 | # Third party apps configuration 155 | CRISPY_TEMPLATE_PACK = 'bootstrap4' 156 | 157 | STATIC_ROOT = BASE_DIR / 'mysite' / 'staticfiles' 158 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/css/app.css: -------------------------------------------------------------------------------- 1 | .logo { 2 | font-family: 'Clicker Script', cursive; 3 | } 4 | 5 | .logo a { 6 | color: #212529; 7 | text-decoration: none; 8 | } 9 | 10 | footer { 11 | font-size: .9rem; 12 | } 13 | 14 | footer a { 15 | color: #212529; 16 | } 17 | 18 | .list-group-formset label { 19 | display: none; 20 | } 21 | 22 | .list-group-formset .form-group, 23 | .list-group-formset .invalid-feedback { 24 | margin-bottom: 0; 25 | } 26 | 27 | .list-group-formset .form-control { 28 | padding: .25rem .5rem; 29 | font-size: .875rem; 30 | line-height: 1.5; 31 | border-radius: .2rem; 32 | } 33 | 34 | .btn-student { 35 | color: #fff; 36 | background-color: #91afb6; 37 | border-color: #91afb6; 38 | } 39 | 40 | .btn-student:hover, 41 | .btn-student:active { 42 | color: #fff; 43 | background-color: #608993; 44 | border-color: #608993; 45 | } 46 | 47 | .btn-teacher { 48 | color: #fff; 49 | background-color: #8980a5; 50 | border-color: #8980a5; 51 | } 52 | 53 | .btn-teacher:hover, 54 | .btn-teacher:active { 55 | color: #fff; 56 | background-color: #66598B; 57 | border-color: #66598B; 58 | } 59 | 60 | .has-danger .radio, 61 | .has-danger .checkbox { 62 | color: #dc3545; 63 | } 64 | 65 | .has-danger .invalid-feedback { 66 | display: block; 67 | } -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/css/students.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #c2d4d8; 3 | } 4 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/css/teachers.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #b0aac2; 3 | } 4 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/datatables/dataTables.bootstrap4.min.css: -------------------------------------------------------------------------------- 1 | table.dataTable{clear:both;margin-top:6px !important;margin-bottom:6px !important;max-width:none !important;border-collapse:separate !important;border-spacing:0}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper div.dataTables_length label{font-weight:normal;text-align:left;white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{width:auto;display:inline-block}div.dataTables_wrapper div.dataTables_filter{text-align:right}div.dataTables_wrapper div.dataTables_filter label{font-weight:normal;white-space:nowrap;text-align:left}div.dataTables_wrapper div.dataTables_filter input{margin-left:0.5em;display:inline-block;width:auto}div.dataTables_wrapper div.dataTables_info{padding-top:0.85em;white-space:nowrap}div.dataTables_wrapper div.dataTables_paginate{margin:0;white-space:nowrap;text-align:right}div.dataTables_wrapper div.dataTables_paginate ul.pagination{margin:2px 0;white-space:nowrap;justify-content:flex-end}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1em 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:30px}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;position:relative}table.dataTable thead .sorting:before,table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:before,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:before,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:before,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:before,table.dataTable thead .sorting_desc_disabled:after{position:absolute;bottom:0.9em;display:block;opacity:0.3}table.dataTable thead .sorting:before,table.dataTable thead .sorting_asc:before,table.dataTable thead .sorting_desc:before,table.dataTable thead .sorting_asc_disabled:before,table.dataTable thead .sorting_desc_disabled:before{right:1em;content:"\2191"}table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{right:0.5em;content:"\2193"}table.dataTable thead .sorting_asc:before,table.dataTable thead .sorting_desc:after{opacity:1}table.dataTable thead .sorting_asc_disabled:before,table.dataTable thead .sorting_desc_disabled:after{opacity:0}div.dataTables_scrollHead table.dataTable{margin-bottom:0 !important}div.dataTables_scrollBody table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody table thead .sorting:before,div.dataTables_scrollBody table thead .sorting_asc:before,div.dataTables_scrollBody table thead .sorting_desc:before,div.dataTables_scrollBody table thead .sorting:after,div.dataTables_scrollBody table thead .sorting_asc:after,div.dataTables_scrollBody table thead .sorting_desc:after{display:none}div.dataTables_scrollBody table tbody tr:first-child th,div.dataTables_scrollBody table tbody tr:first-child td{border-top:none}div.dataTables_scrollFoot>.dataTables_scrollFootInner{box-sizing:content-box}div.dataTables_scrollFoot>.dataTables_scrollFootInner>table{margin-top:0 !important;border-top:none}@media screen and (max-width: 767px){div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate{text-align:center}}table.dataTable.table-sm>thead>tr>th{padding-right:20px}table.dataTable.table-sm .sorting:before,table.dataTable.table-sm .sorting_asc:before,table.dataTable.table-sm .sorting_desc:before{top:5px;right:0.85em}table.dataTable.table-sm .sorting:after,table.dataTable.table-sm .sorting_asc:after,table.dataTable.table-sm .sorting_desc:after{top:5px}table.table-bordered.dataTable th,table.table-bordered.dataTable td{border-left-width:0}table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable td:last-child,table.table-bordered.dataTable td:last-child{border-right-width:0}table.table-bordered.dataTable tbody th,table.table-bordered.dataTable tbody td{border-bottom-width:0}div.dataTables_scrollHead table.table-bordered{border-bottom-width:0}div.table-responsive>div.dataTables_wrapper>div.row{margin:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:first-child{padding-left:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:last-child{padding-right:0} 2 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/datatables/dataTables.bootstrap4.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | DataTables Bootstrap 4 integration 3 | ©2011-2017 SpryMedia Ltd - datatables.net/license 4 | */ 5 | (function(b){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(a){return b(a,window,document)}):"object"===typeof exports?module.exports=function(a,d){a||(a=window);if(!d||!d.fn.dataTable)d=require("datatables.net")(a,d).$;return b(d,a,a.document)}:b(jQuery,window,document)})(function(b,a,d,m){var f=b.fn.dataTable;b.extend(!0,f.defaults,{dom:"<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>", 6 | renderer:"bootstrap"});b.extend(f.ext.classes,{sWrapper:"dataTables_wrapper dt-bootstrap4",sFilterInput:"form-control form-control-sm",sLengthSelect:"custom-select custom-select-sm form-control form-control-sm",sProcessing:"dataTables_processing card",sPageButton:"paginate_button page-item"});f.ext.renderer.pageButton.bootstrap=function(a,h,r,s,j,n){var o=new f.Api(a),t=a.oClasses,k=a.oLanguage.oPaginate,u=a.oLanguage.oAria.paginate||{},e,g,p=0,q=function(d,f){var l,h,i,c,m=function(a){a.preventDefault(); 7 | !b(a.currentTarget).hasClass("disabled")&&o.page()!=a.data.action&&o.page(a.data.action).draw("page")};l=0;for(h=f.length;l", 8 | {"class":t.sPageButton+" "+g,id:0===r&&"string"===typeof c?a.sTableId+"_"+c:null}).append(b("",{href:"#","aria-controls":a.sTableId,"aria-label":u[c],"data-dt-idx":p,tabindex:a.iTabIndex,"class":"page-link"}).html(e)).appendTo(d),a.oApi._fnBindAction(i,{action:c},m),p++)}},i;try{i=b(h).find(d.activeElement).data("dt-idx")}catch(v){}q(b(h).empty().html('
    ').children("ul"),s);i!==m&&b(h).find("[data-dt-idx="+i+"]").focus()};return f}); 9 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/china-testing/python_cn_resouce/2eee52f3fa304899d749e7f6f3b613ada87a0ff9/django_examples/django_school/mysite/static/img/favicon.ico -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/img/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/china-testing/python_cn_resouce/2eee52f3fa304899d749e7f6f3b613ada87a0ff9/django_examples/django_school/mysite/static/img/favicon.png -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/vendor/fontello-2f186091/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Font license info 2 | 3 | 4 | ## Fontelico 5 | 6 | Copyright (C) 2012 by Fontello project 7 | 8 | Author: Crowdsourced, for Fontello project 9 | License: SIL (http://scripts.sil.org/OFL) 10 | Homepage: http://fontello.com 11 | 12 | 13 | ## Entypo 14 | 15 | Copyright (C) 2012 by Daniel Bruce 16 | 17 | Author: Daniel Bruce 18 | License: SIL (http://scripts.sil.org/OFL) 19 | Homepage: http://www.entypo.com 20 | 21 | 22 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/vendor/fontello-2f186091/README.txt: -------------------------------------------------------------------------------- 1 | This webfont is generated by http://fontello.com open source project. 2 | 3 | 4 | ================================================================================ 5 | Please, note, that you should obey original font licenses, used to make this 6 | webfont pack. Details available in LICENSE.txt file. 7 | 8 | - Usually, it's enough to publish content of LICENSE.txt file somewhere on your 9 | site in "About" section. 10 | 11 | - If your project is open-source, usually, it will be ok to make LICENSE.txt 12 | file publicly available in your repository. 13 | 14 | - Fonts, used in Fontello, don't require a clickable link on your site. 15 | But any kind of additional authors crediting is welcome. 16 | ================================================================================ 17 | 18 | 19 | Comments on archive content 20 | --------------------------- 21 | 22 | - /font/* - fonts in different formats 23 | 24 | - /css/* - different kinds of css, for all situations. Should be ok with 25 | twitter bootstrap. Also, you can skip style and assign icon classes 26 | directly to text elements, if you don't mind about IE7. 27 | 28 | - demo.html - demo file, to show your webfont content 29 | 30 | - LICENSE.txt - license info about source fonts, used to build your one. 31 | 32 | - config.json - keeps your settings. You can import it back into fontello 33 | anytime, to continue your work 34 | 35 | 36 | Why so many CSS files ? 37 | ----------------------- 38 | 39 | Because we like to fit all your needs :) 40 | 41 | - basic file, .css - is usually enough, it contains @font-face 42 | and character code definitions 43 | 44 | - *-ie7.css - if you need IE7 support, but still don't wish to put char codes 45 | directly into html 46 | 47 | - *-codes.css and *-ie7-codes.css - if you like to use your own @font-face 48 | rules, but still wish to benefit from css generation. That can be very 49 | convenient for automated asset build systems. When you need to update font - 50 | no need to manually edit files, just override old version with archive 51 | content. See fontello source code for examples. 52 | 53 | - *-embedded.css - basic css file, but with embedded WOFF font, to avoid 54 | CORS issues in Firefox and IE9+, when fonts are hosted on the separate domain. 55 | We strongly recommend to resolve this issue by `Access-Control-Allow-Origin` 56 | server headers. But if you ok with dirty hack - this file is for you. Note, 57 | that data url moved to separate @font-face to avoid problems with 2 | 3 | 4 | 278 | 279 | 291 | 292 | 293 |
    294 |

    295 | fontello 296 | font demo 297 |

    298 | 301 |
    302 |
    303 |
    304 |
    icon-emo-happy0xe801
    305 |
    icon-graduation-cap-10xe803
    306 |
    icon-feather0xe808
    307 |
    308 |
    309 |
    310 | 311 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/vendor/fontello-2f186091/font/fontello.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/china-testing/python_cn_resouce/2eee52f3fa304899d749e7f6f3b613ada87a0ff9/django_examples/django_school/mysite/static/vendor/fontello-2f186091/font/fontello.eot -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/vendor/fontello-2f186091/font/fontello.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Copyright (C) 2018 by original authors @ fontello.com 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/vendor/fontello-2f186091/font/fontello.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/china-testing/python_cn_resouce/2eee52f3fa304899d749e7f6f3b613ada87a0ff9/django_examples/django_school/mysite/static/vendor/fontello-2f186091/font/fontello.ttf -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/vendor/fontello-2f186091/font/fontello.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/china-testing/python_cn_resouce/2eee52f3fa304899d749e7f6f3b613ada87a0ff9/django_examples/django_school/mysite/static/vendor/fontello-2f186091/font/fontello.woff -------------------------------------------------------------------------------- /django_examples/django_school/mysite/static/vendor/fontello-2f186091/font/fontello.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/china-testing/python_cn_resouce/2eee52f3fa304899d749e7f6f3b613ada87a0ff9/django_examples/django_school/mysite/static/vendor/fontello-2f186091/font/fontello.woff2 -------------------------------------------------------------------------------- /django_examples/django_school/mysite/templates/404.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | Django School 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
    15 |
    16 |
    17 |

    Python测试开发学院

    18 |

    404

    19 |

    Page not found ¯\_(ツ)_/¯

    20 |

    返回首页 →

    21 |
    22 |
    23 |
    24 | 25 | 26 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/templates/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Django School 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
    15 |
    16 |
    17 |

    Python测试开发学院

    18 |

    500

    19 |

    Something went wrong 😭

    20 |

    Mind to send me a tweet about this issue?

    21 |

    Go to the home page →

    22 |
    23 |
    24 |
    25 | 26 | 27 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | {% block title %}Python测试开发学院{% endblock %} 7 | 8 | 9 | 10 | 11 | 12 | {% if user.is_authenticated and user.is_teacher %} 13 | 14 | {% else %} 15 | 16 | {% endif %} 17 | {% block css %} 18 | {% endblock %} 19 | 20 | 21 | Fork me on GitHub 22 |
    23 |
    24 |
    25 |
    26 | 40 |
    41 | {% if user.is_authenticated %} 42 |

    43 | {% if user.is_student %} 44 | {{ user.username }} - {{user.student.score}} 45 | {% else %} 46 | {{ user.username }} 47 | {% endif %} 48 | | 登出 49 |

    50 | {% else %} 51 | 登录 52 | 注册 53 | {% endif %} 54 |
    55 |
    56 |
    57 |
    58 | {% for message in messages %} 59 | 65 | {% endfor %} 66 | 67 | {% block content %} 68 | {% endblock %} 69 |
    70 |
    71 |
    72 |
    73 |
    74 | 75 | 82 | {% block js %} 83 | {% endblock %} 84 | 85 | 86 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/templates/registration/login.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% load crispy_forms_tags %} 4 | 5 | {% block content %} 6 | {% include 'classroom/_guest_header.html' %} 7 | {% if form.non_field_errors %} 8 | 16 | {% endif %} 17 |
    18 |
    19 |

    Log in

    20 |
    21 | {% csrf_token %} 22 | 23 | {{ form.username|as_crispy_field }} 24 | {{ form.password|as_crispy_field }} 25 |
    或新用户 注册 26 |
    27 |
    28 |
    29 |
    30 | {% endblock %} 31 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/templates/registration/signup_form.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% load crispy_forms_tags %} 4 | 5 | {% block content %} 6 | {% include 'classroom/_guest_header.html' %} 7 | 23 | 24 |
    25 |
    26 |

    Sign up as a {{ user_type }}

    27 |
    28 | {% csrf_token %} 29 | 30 | {{ form|crispy }} 31 | 32 |
    33 |
    34 |
    35 | {% endblock %} 36 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/urls.py: -------------------------------------------------------------------------------- 1 | """mysite URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/4.0/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | 17 | 18 | 19 | from django.urls import include, path 20 | from django.contrib import admin 21 | from classroom.views import classroom, students, teachers 22 | from django.contrib.auth import views as auth_views 23 | 24 | urlpatterns = [ 25 | path('admin/', admin.site.urls), 26 | path('', include('classroom.urls')), 27 | # path('accounts/login/', auth_views.LoginView.as_view(redirect_authenticated_user=True), name='login'), 28 | path('accounts/', include('django.contrib.auth.urls')), 29 | path('accounts/signup/', students.StudentSignUpView.as_view(), name='signup'), 30 | # path('accounts/signup/student/', students.StudentSignUpView.as_view(), name='student_signup'), 31 | path('accounts/signup/teacher/', teachers.TeacherSignUpView.as_view(), name='teacher_signup'), 32 | path('oauth/', include('social_django.urls', namespace='social')), # <-- 33 | 34 | ] 35 | 36 | -------------------------------------------------------------------------------- /django_examples/django_school/mysite/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for mysite project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /django_examples/django_school/requirements.txt: -------------------------------------------------------------------------------- 1 | Django 2 | django-crispy-forms 3 | social-auth-app-django 4 | python-decouple 5 | -------------------------------------------------------------------------------- /flask.md: -------------------------------------------------------------------------------- 1 | # Awesome Flask [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) 2 | 3 | 收集了大量 Flask 相关的优秀应用、项目等资源,方便了 Flask 用户参考查阅。 4 | 5 | [Flask 优秀资源大全](https://github.com/china-testing/python_cn_resouce/blob/main/fastapi.md ) 则是翻译而来。也欢迎你帮助推荐和提供建议 6 | 7 | 赞善或进入python技术群:钉钉或微信 pythontesting、 支付宝xurongzhong#gmail.com, 请将#替换为@。 8 | 9 | python测试开发钉钉群:21745728,目前800多人,另有几千人的python测试开发微信群,可联系 钉钉或微信号 pythontesting 加群(备注:python)! 10 | 11 | [python八字排盘](https://github.com/china-testing/bazi) 目前市面上功能最强大的八字排盘,科学的尽头是道教,玄学。 12 | 13 | 14 | 15 | * 目录 16 | * [精品图书](#精品图书) 17 | * [框架](#框架) 18 | * [管理界面](#管理界面) 19 | * [验证](#验证) 20 | * [授权](#授权) 21 | * [数据库](#数据库) 22 | * [数据库迁移](#数据库迁移) 23 | * [缓存](#缓存) 24 | * [数据验证](#数据验证) 25 | * [速率限制](#速率限制) 26 | * [任务队列](#任务队列) 27 | * [异常跟踪](#异常跟踪) 28 | * [APM](#apm) 29 | * [其他SDK](#其他sdk) 30 | * [前端](#前端) 31 | * [开发(调试/测试/文档)](#开发调试测试文档) 32 | * [工具](#工具) 33 | * [资源](#资源) 34 | * [教程](#教程) 35 | * [书籍](#书籍) 36 | * [幻灯片](#幻灯片) 37 | * [视频](#视频) 38 | * [项目](#项目) 39 | * [Boilerplate](#boilerplate) 40 | 41 | 42 | ## 精品图书 43 | 44 | 访问密码: 2274, 无需注册,点击普通下载即可。如遇失效可加钉钉或微信 pythontesting获取。 45 | 46 | - [Web API Development with Python A Beginners Guide using Flask and FastAPI .epub](https://url97.ctfile.com/f/18113597-809569549-740e43?p=2274) 47 | 48 | - [Flask Web开发实战:入门、进阶与原理解析 - 2018.pdf](https://itbooks.ctfile.com/fs/18113597-319371801) 49 | 50 | - [Flask Web开发:基于Python的Web应用开发实战(第2版)- 2018.pdf](https://itbooks.ctfile.com/fs/18113597-319371799) 51 | 52 | - [深入理解Flask - 2016.pdf](https://itbooks.ctfile.com/fs/18113597-319371589) 53 | 54 | - [The New And Improved Flask - 2018.pdf](https://itbooks.ctfile.com/fs/18113597-319371576) 55 | 56 | - [Python高效开发实战Django、Tornado、Flask、Twisted - 2016.pdf](https://itbooks.ctfile.com/fs/18113597-319371573) 57 | 58 | - [head first flask - 2016.pdf](https://itbooks.ctfile.com/fs/18113597-319371558) 59 | 60 | - [Flask Web Development 2nd - 2018.pdf](https://itbooks.ctfile.com/fs/18113597-319371546) 61 | 62 | - [Flask Building Python Web Services - 2017.pdf](https://itbooks.ctfile.com/fs/18113597-319371544) 63 | 64 | - [Flask Blueprints - 2015.pdf](https://itbooks.ctfile.com/fs/18113597-319371537) 65 | 66 | - [Building Web Applications with Flask - 2015.pdf](https://itbooks.ctfile.com/fs/18113597-319371534) 67 | 68 | ## 框架 69 | 70 | - [Connexion](https://github.com/zalando/connexion) - Swagger/OpenAPI,支持自动端点验证和OAuth2 ★★ 71 | - [Eve](https://github.com/pyeve/eve) - 机遇Flask、MongoDB的REST API框架 ★★★★★ 72 | - [Flask-RESTful](https://github.com/flask-restful/flask-restful) - 用于创建REST API的简单框架 ★★★★★ 73 | - [Flask-RestPlus](https://github.com/noirbizarre/flask-restplus) - 语法糖、帮助器和自动生成的Swagger文档。 ★★ 74 | - [Zappa](https://github.com/Miserlou/Zappa) - 在AWS Lambda和API网关上构建和部署无服务器的Flask应用程序 ★★★★★ 75 | 76 | ## 管理界面 77 | 78 | - [Flask-Admin](https://github.com/flask-admin/flask-admin) - Flask的简单和可扩展的管理界面框架 ★★★★ 79 | 80 | 81 | ## 验证 82 | 83 | - [Flask-Security](https://github.com/mattupstate/flask-security) - 为Flask应用程序提供快速和简单的安全保护。 84 | - [Flask-Login](https://github.com/maxcountryman/flask-login) - Flask用户会话管理 ★★ 85 | - [Flask-User](https://github.com/lingthio/Flask-User) - Flask的可定制的用户账户管理 86 | - [Flask-HTTPAuth](https://github.com/miguelgrinberg/Flask-HTTPAuth) - 简单的扩展,为Flask路由提供Basic和Digest HTTP认证。 87 | 88 | ## 授权 89 | 90 | - [Authlib](https://github.com/lepture/authlib) - Authlib是一个雄心勃勃的认证库,用于OAuth 1、OAuth 2、OpenID客户端、服务器等。 ★★ 91 | - [Authomatic](https://github.com/authomatic/authomatic) - Authomatic为使用OAuth 1.0a(Twitter、Tumblr等)和OAuth 2.0(Facebook、Foursquare、GitHub、Google、LinkedIn、PayPal等)的一些提供者提供开箱即用的支持。 92 | - [Flask-Dance](https://github.com/singingwolfboy/flask-dance) - Flask的OAuth消费者扩展,预先设置了对Facebook、GitHub、Google等的支持。 93 | 94 | ## 数据库 95 | 96 | - [Flask-MongoEngine](https://github.com/MongoEngine/flask-mongoengine) - MongoEngine的Flask扩展,支持WTF模型形式。 97 | - [Flask-SQLAlchemy](https://github.com/mitsuhiko/flask-sqlalchemy) - 为Flask添加SQLAlchemy支持。 ★★★ 98 | 99 | ## 数据库迁移 100 | 101 | - [Flask-Migrate](https://github.com/miguelgrinberg/Flask-Migrate) - 使用Alembic为Flask应用程序进行SQLAlchemy数据库迁移。 ★ 102 | 103 | ## 缓存 104 | 105 | - [Flask-Caching](https://github.com/sh4nks/flask-caching) - 为Flask添加简单的缓存支持 106 | 107 | ## 数据验证 108 | 109 | - [Flask-WTF](https://github.com/lepture/flask-wtf) - Flask和WTForms的简单集成,包括CSRF、文件上传和Recaptcha的集成。 110 | 111 | 112 | ## 速率限制 113 | 114 | - [Flask-Limiter](https://github.com/alisaifee/flask-limiter) - Flask-Limiter为flask路线提供速率限制功能。 115 | 116 | ## 任务队列 117 | 118 | - [huey](https://github.com/coleifer/huey) - 一个用于python的小任务队列 ★★★ 119 | - [celery](https://github.com/celery/celery/) - 分布式任务队列 ★★★★★ 120 | 121 | ## 异常跟踪 122 | 123 | - [sentry-sdk](https://github.com/getsentry/sentry-python) - [Sentry](https://sentry.io/welcome/)的Python客户端。 124 | 125 | 126 | ## APM 127 | 128 | - [elastic-apm](https://github.com/elastic/apm-agent-python) - Python的Elastic APM代理。 129 | 130 | ## 其他SDK 131 | 132 | - [Flask-GoogleMaps](https://github.com/rochacbruno/Flask-GoogleMaps) - 在Flask模板中建立和嵌入谷歌地图 133 | 134 | ## 前端 135 | 136 | - [Flask-CORS](https://github.com/corydolphin/flask-cors) - 用于处理跨源资源共享(CORS)的Flask扩展,使跨源AJAX成为可能。 137 | 138 | ## 开发(调试/测试/文档) 139 | 140 | - [flask_profiler](https://github.com/muatik/flask-profiler) - Flask的端点分析器/profiler 141 | - [Flask-DebugToolbar](https://github.com/mgood/flask-debugtoolbar) - 将django的调试工具条移植到flask上。 142 | - [Flask-Testing](https://github.com/jarus/flask-testing) - 用于Flask的Unittest扩展 143 | - [pytest-flask](https://github.com/pytest-dev/pytest-flask) - 一组用于测试Flask应用程序的pytest fixtures 144 | - [Flask-MonitoringDashboard](https://github.com/flask-dashboard/Flask-MonitoringDashboard) - 自动监测Flask/Python Web服务的性能变化。 145 | - [nplusone](https://github.com/jmcarp/nplusone#flask-sqlalchemy) - 使用Flask和SQLAlchemy自动检测n+1个查询。 146 | - [connexion](https://github.com/zalando/connexion) - Swagger/OpenAPI,支持自动端点验证和OAuth2。 147 | 148 | ## 工具 149 | 150 | - [flask-marshmallow](https://github.com/marshmallow-code/flask-marshmallow) Flask + marshmallow for beautiful APIs 151 | - [Mixer](https://github.com/klen/mixer) - Mixer是用于生成Django或SQLAlchemy模型实例的应用程序。 152 | - [Flask-SocketIO](https://github.com/miguelgrinberg/Flask-SocketIO) - 为Flask应用程序整合Socket.IO ★★★★ 153 | - [Flask-Moment](https://github.com/miguelgrinberg/Flask-Moment) - 在Flask模板中使用moment.js对日期和时间进行格式化。 154 | - [Flask-graphql](https://github.com/graphql-python/flask-graphql) - 将GraphQL支持添加到你的Flask应用程序中。 155 | 156 | # 资源 157 | ## 教程 158 | 159 | - [如何建立一个永不停机且几乎不花钱的新闻应用](http://blog.apps.npr.org/2013/02/14/app-template-redux.html) (由NPR提供) 160 | - [用Flask在Python中构建网站](http://maximebf.com/blog/2012/10/building-websites-in-python-with-flask/) 161 | - [Flask大型教程](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world) 162 | - [用Python和Flask实现一个RESTful Web API](http://blog.luisrei.com/articles/flaskrest.html) 163 | - [发现Flask--用Flask进行全栈网络开发](https://github.com/realpython/discover-flask) 164 | - [Flaskr--Flask、测试驱动开发和jQuery介绍](https://github.com/mjhea0/flaskr-tdd) 165 | 166 | ## 课程 167 | 168 | - [全栈基础](https://www.udacity.com/course/full-stack-foundations--ud088) 169 | - [设计RESTful APIs](https://www.udacity.com/course/designing-restful-apis--ud388) 170 | 171 | ## 书籍 172 | 173 | - [探索Flask](https://exploreflask.com/en/latest/) 174 | - [Flask Web开发](http://shop.oreilly.com/product/0636920031116.do) 175 | - [Real Python](https://realpython.com) 176 | - [Flask Framework Cookbook](https://www.packtpub.com/web-development/flask-framework-cookbook) 177 | 178 | ## 幻灯片 179 | 180 | - [用Flask创建漂亮的REST API](http://pycoder.net/bospy/presentation.html) 181 | - [高级Flask模式](https://speakerdeck.com/mitsuhiko/advanced-flask-patterns) 182 | - [Flasky Goodness](https://speakerdeck.com/kennethreitz/flasky-goodness) 183 | - [领域驱动设计(...用Flask)](https://speakerdeck.com/mikedebo/domain-driven-design-dot-dot-dot-with-flask) 184 | - [In Flask we Trust](https://speakerdeck.com/playpauseandstop/in-flask-we-trust) 185 | 186 | ## 视频 187 | 188 | - [PyVideo](https://pyvideo.org/search.html?q=flask) 189 | - [实用Flask网络开发教程](https://www.youtube.com/playlist?list=PLQVvvaa0QuDc_owjTbIY4rbgXOFkUYOUB) 190 | 191 | ## 项目 192 | 193 | - [zmusic-ng](https://git.zx2c4.com/zmusic-ng/) - ZX2C4 Music提供了一个使用元数据播放和下载音乐文件的网络接口。 194 | - [redispapa](https://github.com/no13bus/redispapa) - 使用flask、angular、socket.io的另一个redis监视器 195 | - [Frozen-Flask](https://github.com/Frozen-Flask/Frozen-Flask) - 将Flask应用程序冻结为一组静态文件 196 | - [Skylines](https://github.com/skylines-project/skylines) - 实时跟踪、飞行数据库和竞赛框架 197 | - [airflow](https://github.com/apache/incubator-airflow) - Airflow是一个以编程方式编写、安排和监控数据管道的系统。 ★★★★★ 198 | - [timesketch](https://github.com/google/timesketch) - 协作取证的时间线分析 ★★ 199 | - [security_monkey](https://github.com/Netflix/security_monkey) - 监视政策变化并对AWS账户中的不安全配置发出警报。 ★★★ 200 | - [securedrop](https://github.com/freedomofpress/securedrop)--一个开源的举报人提交系统,媒体机构可以用它来安全地接受匿名来源的文件并与之沟通。 ★★ 201 | - [sync_engine](https://github.com/nylas/sync-engine) - 具有现代API的IMAP/SMTP同步系统 ★★ 202 | - [indico](https://github.com/indico/indico) - 通用的活动管理网络解决方案。它包括一个完整的会议组织工作流程,以及会议管理和房间预订的工具。它还提供与视频会议解决方案的整合。 203 | - [flaskbb](https://github.com/flaskbb/flaskbb) - 使用Flask的经典Python论坛软件。 204 | 205 | ## Boilerplate 206 | 207 | - [fbone](https://github.com/imwilsonxu/fbone) 208 | - [cookiecutter-flask](https://github.com/sloria/cookiecutter-flask) ★★★ 209 | - [Flask-Foundation](https://github.com/JackStouffer/Flask-Foundation) 210 | - [gae-init](https://gae-init.appspot.com) - 在谷歌应用引擎上运行的Flask锅炉模板 211 | - [Flask-AppBuilder](https://github.com/dpgaspar/Flask-AppBuilder) - 简单快速的应用程序生成器框架,建立在Flask之上。包括详细的安全性、自动生成表单、谷歌图表等内容。 ★★★ -------------------------------------------------------------------------------- /other_books.md: -------------------------------------------------------------------------------- 1 | ## 书法 2 | 3 | [中国最美的100传世书法 - 2008.pdf](https://itbooks.pipipan.com/fs/18113597-317105811) 4 | 5 | [中国书法全集(第一册)\- 2009.pdf](https://itbooks.pipipan.com/fs/18113597-317105797) 6 | 7 | [中国书法全集(第二册)\- 2009.pdf](https://itbooks.pipipan.com/fs/18113597-317105784) 8 | 9 | [中国书法(人文中国书系)(中文版)\- 2010.pdf](https://itbooks.pipipan.com/fs/18113597-317105772) 10 | 11 | [赵孟頫书法精选 \- 2016.pdf](https://itbooks.pipipan.com/fs/18113597-317105764) 12 | 13 | [与古为徒和娟娟发屋:关于书法经典问题的思考 \- 2016.pdf](https://itbooks.pipipan.com/fs/18113597-317105760) 亚马逊4星 11评论 14 | 15 | [永字八法书法艺术讲义\- 2015.pdf](https://itbooks.pipipan.com/fs/18113597-317105709) 亚马逊4星 20评论 16 | 17 | [小书馆:书法指南 \- 2014.pdf](https://itbooks.pipipan.com/fs/18113597-317105695) 18 | 19 | [书法入门十八法•集王羲之书圣教序 \- 2017.pdf](https://itbooks.pipipan.com/fs/18113597-317105679) 20 | 21 | [书法入门必读 \- 2013.pdf](https://itbooks.pipipan.com/fs/18113597-317105676) 22 | 23 | [书法没有秘密 \- 2012.pdf](https://itbooks.pipipan.com/fs/18113597-317105662) 24 | 25 | [书法教程《宋徽宗瘦金体及其笔法》 \- 2017.pdf](https://itbooks.pipipan.com/fs/18113597-317105643) 26 | 27 | [书法:18个关键词 - 2015.pdf](https://itbooks.pipipan.com/fs/18113597-317105640) 28 | 29 | [启功给你讲书法(典藏版) \- 2012.pdf](https://itbooks.pipipan.com/fs/18113597-317105623) 亚马逊4星 50评论 30 | 31 | [极简中国书法史 (极简系列) \- 2014.pdf](https://itbooks.pipipan.com/fs/18113597-317105610) 亚马逊4.5星 50评论 32 | 33 | [敦煌古代书法艺术 \- 2008.pdf](https://itbooks.pipipan.com/fs/18113597-317105598) -------------------------------------------------------------------------------- /society_books.md: -------------------------------------------------------------------------------- 1 | 2 | 如需要密码访问,为2274 3 | 4 | 5 | 目录 6 | ================= 7 | 8 | * [社科书籍](#社科书籍) 9 | * [传记](#传记) 10 | * [文案营销](#文案营销) 11 | * [国学](#国学) 12 | * [地理](#地理) 13 | * [励志](#励志) 14 | * [健身](#健身) 15 | * [记忆力](#记忆力) 16 | * [英语](#英语) 17 | * [管理](#管理) 18 | * [心理学](#心理学) 19 | * [历史](#历史) 20 | 21 | 22 | ## 介绍 23 | 24 | 收集社科类精品书籍。 25 | 26 | 赞赏或进入python技术群:钉钉或微信 pythontesting、 支付宝xurongzhong#gmail.com, 请将#替换为@。 27 | 28 | python测试开发钉钉群:21745728,目前800多人,另有几千人的python测试开发微信群,可联系 钉钉或微信号 pythontesting 加群(备注:python)! 29 | 30 | [python八字排盘](https://github.com/china-testing/bazi) 目前市面上功能最强大的八字排盘,科学的尽头是道教,玄学。 31 | 32 | 33 | 34 | # 社科书籍 35 | 36 | 访问密码: 2274 37 | 38 | - [管理大师稻盛和夫经典收藏版共6册 《拯救人类的哲学》、《干法》、《领导者的资质》《调动员工积极性的七个关键》、《阿米巴经营(实战篇)》《稻盛和夫语录100条》》](https://url97.ctfile.com/f/18113597-810568881-89b1f2?p=2274) 39 | 40 | - [书籍: 上海读客 知行合一王阳明大合集(1+2+3+传习录)](https://url97.ctfile.com/f/18113597-810569028-87dfaf?p=2274) 41 | 42 | - [月亮与六便士(全本未删节插图珍藏版,毛姆经典代表作2017全新畅销译本)(作家榜推荐).pdf](https://url97.ctfile.com/f/18113597-810843138-a2db6f?p=227) 43 | 44 | - [原则(华尔街投资人、桥水公司创始人雷·达里奥白手起家40多年的生活与工作原则)-2018.pdf](https://url97.ctfile.com/f/18113597-811199231-487e44?p=2274) 45 | 46 | - [三体全集-2012.pdf 小说](https://url97.ctfile.com/f/18113597-811199384-ff2adc?p=2274) 47 | 48 | - [债务危机 - 2019.pdf](https://url97.ctfile.com/f/18113597-811199935-65771c?p=227) 49 | 50 | - [见识城邦·童年的消逝 - 2015.pdf](https://itbooks.pipipan.com/fs/18113597-368444177) 51 | 52 | ## 传记 53 | 54 | - [一往无前小米-2020 A4.5-162.epub](https://url97.ctfile.com/f/18113597-811280525-4e65a8?p=2274) (访问密码: 2274) 55 | - [腾讯传 2016 A4.2-201.epub](https://url97.ctfile.com/f/18113597-811280517-4ccc38?p=2274) (访问密码: 2274) 56 | - [曾国藩传-2019 A4.7-179__.pdf]( https://url97.ctfile.com/f/18113597-811280515-9cc137?p=2274) (访问密码: 2274) 57 | - [曾国藩传-2019 A4.7-179__.epub](https://url97.ctfile.com/f/18113597-811280447-e79a84?p=2274) (访问密码: 2274) 58 | - [曾国藩唐浩明钦定版修订老版-2014 A4.7-495.epub](https://url97.ctfile.com/f/18113597-811280320-1e7963?p=2274) (访问密码: 2274) 59 | - [曾国藩又笨又慢平天下-2016 A4.5-285.epub](https://url97.ctfile.com/f/18113597-811280315-66a670?p=2274) (访问密码: 2274) 60 | - [我坚信-2015 A4-126.epub](https://url97.ctfile.com/f/18113597-811280313-f205cb?p=2274) (访问密码: 2274) 61 | - [昨日的世界:一个欧洲人的回忆.epub](https://url97.ctfile.com/f/18113597-811280306-b84554?p=2274) (访问密码: 2274) 62 | - [将心注入-2020 A4.4-344.epub](https://url97.ctfile.com/f/18113597-811280311-469faf?p=2274) (访问密码: 2274) 63 | - [人类群星闪耀时-奥地利斯蒂芬•茨威格 陕西人民出版社.epub](https://url97.ctfile.com/f/18113597-811280304-4d161a?p=2274) (访问密码: 2274) 64 | - [蒋介石与现代中国-陶涵.epub](https://url97.ctfile.com/f/18113597-811280251-1a839b?p=2274) (访问密码: 2274) 65 | - [《史蒂夫·乔布斯传 精品》沃尔特.艾萨克森.epub](https://url97.ctfile.com/f/18113597-811280243-22ee15?p=2274) (访问密码: 2274) 66 | - [《爱你就像爱生命 精品》王小波.epub](https://url97.ctfile.com/f/18113597-811280214-de769b?p=2274) (访问密码: 2274) 67 | - [《饥饿的盛世 精品》.epub](https://url97.ctfile.com/f/18113597-811280188-739e25?p=2274) (访问密码: 2274) 68 | - [傅雷家书(经典版).epub](https://url97.ctfile.com/f/18113597-811280147-3c42ce?p=2274) (访问密码: 2274) 69 | - [一生的旅程:迪士尼CEO的自述.epub](https://url97.ctfile.com/f/18113597-811280136-515e0a?p=2274) (访问密码: 2274) 70 | - [段永平投资问答录.epub](https://url97.ctfile.com/f/18113597-811280131-171043?p=2274) (访问密码: 2274) 71 | - [知行合一王阳明套装.epub](https://url97.ctfile.com/f/18113597-811280117-82ade9?p=2274) (访问密码: 2274) 72 | - [一生的财富:洛克菲勒写给儿子的38封信.epub](https://url97.ctfile.com/f/18113597-811280115-b18733?p=2274) (访问密码: 2274) 73 | - [人生由我.epub](https://url97.ctfile.com/f/18113597-811280105-13583a?p=2274) (访问密码: 2274) 74 | - [富甲美国:沃尔玛创始人山姆.沃尔顿自传.epub](https://url97.ctfile.com/f/18113597-811280110-99b48f?p=2274) (访问密码: 2274) 75 | - [《过得刚好 精品》.epub](https://url97.ctfile.com/f/18113597-811280097-eb5a7e?p=2274) (访问密码: 2274) 76 | - [褚时健传:影响企业家的企业家.epub](https://url97.ctfile.com/f/18113597-811280090-6f925b?p=2274) (访问密码: 2274) 77 | - [名人传-罗曼罗兰.epub](https://url97.ctfile.com/f/18113597-811280092-6a09cb?p=2274) (访问密码: 2274) 78 | - [希特勒传_从乞丐到元首.epub](https://url97.ctfile.com/f/18113597-811280088-4d81e1?p=2274) (访问密码: 2274) 79 | - [荣格自传:回忆·梦·思考.epub](https://url97.ctfile.com/f/18113597-811280083-a832b8?p=2274) (访问密码: 2274) 80 | - [曾国藩的正面与侧面_完整版.epub](https://url97.ctfile.com/f/18113597-811280081-ce7074?p=2274) (访问密码: 2274) 81 | - [成事:冯唐品读曾国藩嘉言钞.mobi](https://url97.ctfile.com/f/18113597-811280076-4537b7?p=2274) (访问密码: 2274) 82 | - [一个瑜伽行者的自传-帕拉宏撒尤迦南达.epub](https://url97.ctfile.com/f/18113597-811280068-8779ea?p=2274) (访问密码: 2274) 83 | - [一个瑜伽行者的自传-帕拉宏撒尤迦南达.epub](https://url97.ctfile.com/f/18113597-811280068-8779ea?p=2274) (访问密码: 2274) 84 | - [网:阿加西自传 .epub](https://url97.ctfile.com/f/18113597-811279899-7d699a?p=2274) (访问密码: 2274) 85 | - [胡适四十自述.epub](https://url97.ctfile.com/f/18113597-811279892-2eac3c?p=2274) (访问密码: 2274) 86 | - [且以优雅过一生:杨绛传.epub](https://url97.ctfile.com/f/18113597-811279897-f90627?p=2274) (访问密码: 2274) 87 | - [彼得林奇点评版股票作手回忆录_巴菲特指定股市教科书.epub](https://url97.ctfile.com/f/18113597-811279890-a31aad?p=2274) (访问密码: 2274) 88 | - [《南渡北归》三部全集.epub](https://url97.ctfile.com/f/18113597-811279886-dd16b6?p=2274) (访问密码: 2274) 89 | - [留德十年.epub](https://url97.ctfile.com/f/18113597-811279888-0667a6?p=2274) (访问密码: 2274) 90 | - [《向前一步 精品》.epub](https://url97.ctfile.com/f/18113597-811279884-4a6ea9?p=2274) (访问密码: 2274) 91 | - [林徽因传.epub](https://url97.ctfile.com/f/18113597-811279879-51b880?p=2274) (访问密码: 2274) 92 | - [大明王朝的七张面孔(套装共2册).mobi](https://url97.ctfile.com/f/18113597-811279871-50db86?p=2274) (访问密码: 2274) 93 | - [清华园日记-季羡林.epub](https://url97.ctfile.com/f/18113597-811279869-dd04c0?p=2274) (访问密码: 2274) 94 | - [成为:米歇尔·奥巴马自传.epub](https://url97.ctfile.com/f/18113597-811279867-ebb7bb?p=2274) (访问密码: 2274) 95 | 96 | ## 文案营销 97 | 98 | 访问密码: 2274 99 | 100 | - [爆品战略39个超级爆品案例的故事逻辑与方法-2016 A4.2-318.epub](https://url97.ctfile.com/f/18113597-811277065-8c1a2e?p=2274) 101 | - [参与感-2014 A4.4-1482.epub](https://url97.ctfile.com/f/18113597-811277050-e3be56?p=2274) 102 | - [秒赞:文案女王20年创作技巧与心法.epub](https://url97.ctfile.com/f/18113597-811277025-98eef4?p=2274) (访问密码: 2274) 103 | - [爆款文案.epub](https://url97.ctfile.com/f/18113597-811276982-fdfa59?p=2274) (访问密码: 2274) 104 | - [好文案一句话就够了.epub](https://url97.ctfile.com/f/18113597-811276803-4f20e6?p=2274) (访问密码: 2274) 105 | - [文案训练手册.epub](https://url97.ctfile.com/f/18113597-811276798-9377c8?p=2274) (访问密码: 2274) 106 | - [尖叫感:互联网文案创意思维与写作技巧.epub](https://url97.ctfile.com/f/18113597-811276791-bb5f39?p=2274) (访问密码: 2274) 107 | - [文案圣经:如何写出有销售力的文案(奥美人必读7本书之首).epub](https://url97.ctfile.com/f/18113597-811276793-fe806c?p=2274) (访问密码: 2274) 108 | - [《科学的广告+我的广告生涯》.epub](https://url97.ctfile.com/f/18113597-811276783-db48fb?p=2274) (访问密码: 2274) 109 | - [《一个广告人的自白》.epub](https://url97.ctfile.com/f/18113597-811275805-88b9b0?p=2274) (访问密码: 2274) 110 | 111 | 112 | 113 | ## 国学 114 | 115 | 访问密码: 2274 116 | 117 | [中信国学大典五册套装:论语、老子、孟子、庄子、孙子兵法.epub](https://url97.ctfile.com/f/18113597-811200775-9676c9?p=2274) 118 | 119 |  中信国学大典·第5辑世说新语+宋词三百首+唐诗三百首+楚辞+古文观止(套装共5册).pdf 120 | 121 |  中信国学大典·第4辑黄帝内经+颜氏家训+孔子家语+围炉夜话+淮南鸿烈(套装共5册).pdf 122 | 123 |  中信国学大典·第3辑周易+六祖坛经+净土三经+心经+金刚经+礼记孝经)(套装共5册).pdf 124 | 125 |  中信国学大典·第2辑 韩非子 荀子 管子 吕氏春秋 鬼谷子(套装共5册).pdf 126 | 127 |   128 | 129 | ## 地理 130 | 131 | 访问密码: 2274 132 | 133 | - [美国学生世界地理:西方家庭学校经典教材与经典读物(英汉双语版)(上下册) \- 2012.epub](https://url97.ctfile.com/f/18113597-810842638-83f3e8?p=2274) 亚马逊 4.5星 130评 134 | 135 | - [美国《国家地理》125周年伟大瞬间系列丛书(套装共6册)- 2013.pdf](https://url97.ctfile.com/f/18113597-810841882-d17399?p=2274) 亚马逊 4.5星 88评 136 | 137 | - [地理学与生活 \- 2017.epub](https://url97.ctfile.com/f/18113597-810840869-a9daef?p=2274) 亚马逊 4.1星 105评 138 | 139 | - [地理大发现的故事 - 2015.epub](https://url97.ctfile.com/f/18113597-810840869-a9daef?p=227) 亚马逊 4.3星 23评 140 | 141 | - [藏在地理中的历史学(《海洋与文明》《十二幅地图中的世界史》《地理与世界霸权》共3册 - 2016.epub](https://url97.ctfile.com/f/18113597-810840869-a9daef?p=2274) 142 | 143 | 144 | 145 | 走遍中国(珍藏版) (图说天下·国家地理系列) \- 2012.pdf 亚马逊 4星 83评 146 | 147 | 中信国学大典:历史地理(下册)(套装共6册)-2018.pdf 《资治通鉴》、《盐铁论》、《贞观政要》、《山海经》、《水经注》、《人物志》 148 | 149 | 图说天下失落的文明 (国家地理系列) \- 2012.pdf 亚马逊 4星 76评 150 | 151 | 图说天下全球最美的100个地方 - 2007.pdf 亚马逊 4星 304评 152 | 153 | 图说天下环球国家地理(非洲•美洲•两极) (国家地理系列) \- 2007.pdf 亚马逊 3.5星 22评 154 | 155 | 千年一叹(国家地理图文版)\- 2013.pdf 亚马逊 4.5星 83评 156 | 157 | 158 | ## 励志 159 | 160 | 访问密码: 2274 161 | 162 | - [靠自己去成功 (刘墉作品集)-2013 A4.3-189--.pdf](https://url97.ctfile.com/f/18113597-810576475-d9e544?p=2274) 163 | - [人生百忌(1-3册套装) ((刘墉作品集)) - 2012 A4.3-375--.pdf](https://url97.ctfile.com/f/18113597-810577367-74dbfa?p=2274) 164 | - [我不是教你诈(1-5合集)-2019 A4.6-86--.pdf](https://url97.ctfile.com/f/18113597-810577714-dd041b?p=2274) 165 | - [刘墉家书:少爷小姐要争气-2019 A4.3-72--.pdf](https://url97.ctfile.com/f/18113597-810577856-6268d1?p=2274) 166 | - [早起的奇迹那些能够在早晨800前改变人生的秘密-2019 A4.3-159__.pdf](https://url97.ctfile.com/f/18113597-810578015-c055c0?p=2274) 167 | - [掌控习惯-2019 A4.5-85 Atomic Habits-2018 A4.8-37718 __.pdf](https://url97.ctfile.com/f/18113597-810578223-f05dad?p=2274) 168 | - [100个基本-松浦弥太郎的人生信条-2019 A4.2-193__.pdf](https://url97.ctfile.com/f/18113597-810578351-8ce0f9?p=2274) 169 | - [极简主义](https://url97.ctfile.com/f/18113597-810578731-00efa3?p=2274) 170 | - [绝对自控](https://url97.ctfile.com/f/18113597-810579356-db741b?p=2274) 171 | - [学会提问原书第11版-2019 A4.4-39__ Asking the Right Questions A Guide to Critical Thinking (11th Edition) A4.3-274.pdf](https://url97.ctfile.com/f/18113597-810579495-9c8761?p=2274) 172 | - [终身成长-2017](https://url97.ctfile.com/f/18113597-810584208-ee8634?p=2274) 173 | - [一个瑜伽行者的自传-2012 A3.9-228——.pdf](https://url97.ctfile.com/f/18113597-810839851-3d3f7a?p=2274) 174 | 175 | 176 | ## 健身 177 | 178 | 访问密码: 2274 179 | 180 | - [无器械健身.epub](https://url97.ctfile.com/f/18113597-810568233-c1c36d?p=2274) 181 | 182 | - [囚徒健身: 用失传的技艺练就强大的生存实力.pdf](https://url97.ctfile.com/f/18113597-810568345-f10372?p=2274) 183 | 184 | ## 记忆力 185 | 186 | 访问密码: 2274 187 | 188 | - [间谍学校:像间谍一样记忆.pdf](https://url97.ctfile.com/f/18113597-810567825-087b40?p=2274) 189 | 190 | 最强大脑:人人学得会的记忆力训练术.pdf 191 | 192 | ## 英语 193 | 194 | 访问密码: 2274 195 | 196 | - [英语词根与单词的说文解字(修订版).epub](https://url97.ctfile.com/f/18113597-810566727-6c29f6?p=2274) 197 | - [把你的英语用起来.epub](https://url97.ctfile.com/f/18113597-810566910-8b76ec?p=2274) 198 | - Word Smart - Princeton Review.pdf 199 | - On Writing Well, 30th Anniversary Edition_ - Zinsser, William.pdf 200 | - How to Speak and Write Correctly (Mian Fei - Devlin,Joseph.pdf 201 | - [1368个单词就够了.pdf](https://url97.ctfile.com/f/18113597-810567607-75901b?p=2274) 202 | - Word Power Made Easy_ The Complete Handboo - Lewis, Norman.pdf 203 | 204 | 205 | ## 管理 206 | 207 | 访问密码: 2274 208 | 209 | - [领导梯队全面打造领导力驱动型公司(原书第2版)-2014 A4.2-95— The Leadership Pipeline-2011 A4.5-322.pdf](https://url97.ctfile.com/f/18113597-810563701-18426a?p=2274) 210 | 211 | - [格鲁夫给经理人的第一课-2011 A4.4-129-- High Output Management-1995 A4.6-1849-.pdf ](https://url97.ctfile.com/f/18113597-810563747-2aae33?p=2274) 212 | 213 | - [领导的方与圆 曾仕强.epub](https://url97.ctfile.com/f/18113597-810563923-fc3e88?p=2274) 214 | 215 | - [结构思考力 李忠秋.pdf](https://url97.ctfile.com/f/18113597-810564043-2ae6e9?p=2274) 216 | 217 | - [领导力21法则.pdf](https://url97.ctfile.com/f/18113597-810564186-c8b1d3?p=2274) 218 | 219 | ## 心理学 220 | 221 | 访问密码: 2274 222 | 223 | - [幸福的勇气自我启发之父-2019 A4.7-96__.epub](https://url97.ctfile.com/f/18113597-810563000-3f118b?p=2274) 224 | - [心理学通识-2020 A4.4-30__.pdf](https://url97.ctfile.com/f/18113597-810563351-bd8817?p=2274) 225 | - [反障碍如何从障碍中获益 The Obstacle Is the Way-2014 A4.7-4883__.pdf](https://url97.ctfile.com/f/18113597-810563000-3f118b?p=2274) 226 | 227 | ## 历史 228 | 229 | 访问密码: 2274 230 | 231 | - [未来简史.epub](https://url97.ctfile.com/f/18113597-810562917-1c049f?p=2274) 232 | 233 | - [人类简史畅读系列(共6册).epub](https://url97.ctfile.com/f/18113597-811200119-14244d?p=2274) 234 | 235 | - [中国历史那些事儿系列套装:明朝那些事儿(全7册)、这里曾经是汉朝(全6册)、唐史并不如烟(全5册)、如果这是宋史(全10册).pdf](https://url97.ctfile.com/f/18113597-811200224-c2f2c0?p=2274) 236 | 237 | 238 | -------------------------------------------------------------------------------- /tips.md: -------------------------------------------------------------------------------- 1 | # 笑话 2 | 3 | 我是一个苦b的程序员,昨晚加班到现在,困得快睁不开眼了,女上司很关心,问我要不要去吃午饭。我没好气地说,午饭就算了,能让我睡一觉就行了。女上司红着脸说了句讨厌啊,然后坐在我身边不动,好像距离我很近,搞得我很紧张,难道她发现我的程序出了bug? 4 | 5 | ## gitignore 6 | 7 | https://github.com/github/gitignore/blob/master/Python.gitignore 8 | 9 | ## save git password 10 | 11 | git config credential.helper store 12 | 13 | ## git清空历史 14 | 15 | https://stackoverflow.com/questions/13716658/how-to-delete-all-commit-history-in-github 16 | 17 | ## Easy TOC creation for GitHub README.md 18 | 19 | https://github.com/ekalinin/github-markdown-toc 20 | 21 | /home/andrew/code/github-markdown-toc /home/andrew/code/python-testing-examples/README.md 22 | 23 | ## pelican.server 24 | 25 | python3 -m pelican.server 26 | 27 | ## trac 28 | 29 | tracd -s --port 8006 /opt/trac/ -d --basic-auth="*,/opt/trac/.htpasswd,My Test Env" 30 | 31 | ## requests 32 | 33 | application/octet-stream [Python POST binary data](https://stackoverflow.com/questions/14365027/python-post-binary-data) 34 | 35 | [MIME 类型](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Basics_of_HTTP/MIME_types) 36 | 37 | ## 爬虫 allitebooks 38 | 39 | 貌似这个网站的访问现在已经很慢 40 | 41 | https://github.com/jacexh/allitebooks-spider 42 | https://github.com/Kulbear/All-IT-eBooks-Spider 43 | 44 | ## 文件重命名 45 | 46 | https://github.com/nagracks/py_rename 47 | 48 | https://unix.stackexchange.com/questions/19654/changing-extension-to-multiple-files 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /videos.md: -------------------------------------------------------------------------------- 1 | * [国学 中医 历史等社科类书籍下载](https://github.com/china-testing/python-api-tesing/blob/master/society_books.md) 2 | * [电影 视频 下载](https://github.com/china-testing/python-api-tesing/blob/master/videos.md) 3 | * [IT类书籍 下载](https://github.com/china-testing/python-api-tesing/blob/master/books.md) 4 | 5 | ![休息一下,领领红包,祝你中大奖](https://github.com/china-testing/python-api-tesing/blob/master/hongbao.png) 6 | 7 | ### 手诊 8 | 9 | 《手诊与养生保健》系列视频,参见:QQ群184175668 10 | 11 | ### 经典电影 12 | 13 | 14 | [上帝之城.City\_of\_God.CD2.rmvb](https://itbooks.ctfile.com/fs/18113597-317637177) 15 | 16 | [上帝之城.City\_of\_God.CD1.rmvb](https://itbooks.ctfile.com/fs/18113597-317636238) 17 | 18 | [上帝也疯狂.rmvb](https://itbooks.ctfile.com/fs/18113597-317635614) 19 | 20 | [尼罗河上的惨案cd2.rmvb](https://itbooks.ctfile.com/fs/18113597-317634867) 21 | 22 | [尼罗河上的惨案cd1.rmvb](https://itbooks.ctfile.com/fs/18113597-317634237) 23 | 24 | 25 | - [仙履奇缘.rmvb](https://itbooks.ctfile.com/fs/18113597-317622547) 26 | 27 | - [鹿鼎记之神龙教.rm](https://itbooks.ctfile.com/fs/18113597-317620305) 28 | 29 | - [鹿鼎记I.rm](https://itbooks.ctfile.com/fs/18113597-317619138) 30 | 31 | - [举起手来 DVD.rm](https://itbooks.ctfile.com/fs/18113597-317617471) 32 | 33 | - [功夫 \[高清DVD珍藏版\].rmvb](https://itbooks.ctfile.com/fs/18113597-317615772) 34 | 35 | - [大话西游之月光宝盒 高清版 .rmvb](https://itbooks.ctfile.com/fs/18113597-317613672) 36 | 37 | - [小鬼当家B.mp4](https://itbooks.pipipan.com/fs/18113597-313862178) 38 | - [小鬼当家4.rmvb](https://itbooks.pipipan.com/fs/18113597-313861956) 39 | - [小城之春.rmvb](https://itbooks.pipipan.com/fs/18113597-313861891) 40 | 41 | 42 | 43 | * [python3快速入门教程1 turtle绘图-1开始](https://china-testing.github.io/python3_crash1.html) 44 | * [接口自动化性能测试线上培训大纲](https://china-testing.github.io/testing_training.html) 45 | * [python测试开发自动化测试数据分析人工智能自学每周一练](https://china-testing.github.io/python_weeks.html) 46 | * [软件自动化测试初学者忠告](https://china-testing.github.io/testing_automation_tips.html) 47 | 48 | 49 | * 技术支持qq群: 144081101(后期会录制视频存在该群群文件) 591302926 567351477 钉钉免费群:21745728 50 | 51 | * 道家技术-手相手诊看相中医等钉钉群21734177 qq群:391441566 184175668 338228106 看手相、面相、舌相、抽签、体质识别。服务费50元每人次起。请联系钉钉或者微信pythontesting 52 | -------------------------------------------------------------------------------- /zhongyi.md: -------------------------------------------------------------------------------- 1 | 2 | ## 中医 3 | 4 | 购买联系微信 pythontesting 5 | 6 | ### 中医教材 7 | 8 | 9 | 中医诊断学 中医药出版社 十版 大学教材.pdf 10 | 11 | 方剂学 中医药出版社 十版 大学教材.pdf 12 | 13 | 中医内科学-中医药出版社 十版 大学教材.pdf 中药学-中医药出版社 十版 大学教材.pdf 推拿学-中医药出版社 十版 大学教材.pdf 中医气功学 第十版.pdf 中国医学史 14 | 15 | 中医基础理论-中医药出版社 十版 大学教材.pdf 16 | 17 | 新编中医儿科学.epub 18 | 19 | 中西医结合外科学 中西医结合妇产科学 中西医结合内科学 经络腧穴学 实验针灸学 伤寒论选读 中医妇科学 针灸医籍选读 刺法灸法学 针灸学 全国中医药行业高等教育"十三五"规划教材,全国高等中医药院校规划教材) 20 | 21 | 22 | ### 中医经典 23 | 24 | 购买联系微信 pythontesting 25 | 26 | 医学心悟 (中医临床必读丛书) - 2006.pdf 医学心悟 (新安医学名著丛书) - 2009.pdf 27 | 28 | 29 | ### 中草药 30 | 31 | 600种中草药野外识别高清图谱 - 2017.pdf 新编中草药图谱及经典配方 3.pdf 新编中草药图谱及经典配方 2.pdf 新编中草药图谱及经典配方 1 - 2016.pdf 32 | 33 | 34 | 35 | ### 医学科普 36 | 37 | 这些事,医生没有告诉你3远离糖尿病.pdf 38 | 39 | 40 | ### 推拿 41 | 42 | 名医教你从头到脚做推拿 - 2014.pdf 四季推拿养生法 - 2008.pdf 43 | 44 | 大成推拿术 - 2012.pdf 亚马逊4星 6条评论 45 | 46 | 实用小儿推拿 - 2009.pdf 小儿推拿使用手册 - 2013.pdf 47 | 48 | 小儿推拿妈妈做 - 2015.pdf 49 | 50 | 小儿推拿按摩专家教 (73种小儿常见病的推拿、按摩、刮痧疗法) - 2015.pdf 51 | 52 | 小病小痛一推就好 - 2016.pdf 53 | 54 | 常见病推拿防治.pdf 55 | 56 | 手到病除学推拿 - 2013.pdf 57 | 58 | 推拿按摩全书 - 2007.pdf 59 | 60 | 推拿排毒一身轻 - 2010.pdf 亚马逊4.0星 9评论 61 | 62 | 推拿研究与应用 - 2010.pdf 介绍 63 | 64 | 李少波真气运行针灸推拿实践 - 2012.pdf 亚马逊4.5星 12评论 65 | 66 | 李德修小儿推拿秘笈 - 2010.pdf 亚马逊4.2星 148评论 67 | 68 | 每天学点颈肩腰腿病速效自疗 - 2015.pdf 69 | 70 | 汉英对照三字经流派小儿推拿(修订版) - 2011.pdf 亚马逊4.5星 5评论 71 | 72 | 海派儿科推拿 2017.pdf 73 | 74 | 针灸推拿一学就会 - 2009.pdf 介绍 75 | 76 | 零基础学会推拿按摩 - 2015.pdf 亚马逊4.2星 13评论 77 | 78 | 王敬能救命的刮痧书 - 2015.pdf 亚马逊5.0 25 79 | 80 | 图解刮痧拔罐疗法 - 2014.pdf 81 | 82 | 手到病自消全集.2,拔罐、刮痧、艾灸、贴敷祛百病 - 2015.pdf 介绍 83 | 84 | 手到病自除 1——刮痧、拔罐、艾灸、贴敷养生自愈法 - 2016.pdf 亚马逊4.0 18 85 | 86 | 零基础学会拔罐刮痧 - 2015.pdf 87 | 88 | 灸除百病刮痧保健全书:彩图白金版 (中国家庭必备工具书) - 2015.pdf 89 | 90 | 国医绝学家庭使用手册 - 2014.pdf 91 | 92 | 刮痧消百病 - 2014.pdf 93 | 94 | 刮痧拔罐针灸 - 2015.pdf 95 | 96 | 中医养生大宝典 - 2009.pdf 介绍 97 | 98 | ### 拔罐刮痧 99 | 100 | - 小儿推拿按摩专家教 (73种小儿常见病的推拿、按摩、刮痧疗法) - 2015.pdf 101 | - 王敬能救命的刮痧书 2015.pdf 亚马逊5.0 25 102 | - 图解刮痧拔罐疗法 2014.pdf 103 | - 手到病自消全集.2,拔罐、刮痧、艾灸、贴敷祛百病 - 2015.pdf 104 | - 手到病自除 1——刮痧、拔罐、艾灸、贴敷养生自愈法 - 2016.pdf 亚马逊4.0 18 105 | - 零基础学会拔罐刮痧 2015.pdf 106 | - 灸除百病刮痧保健全书:彩图白金版 (中国家庭必备工具书) 2015.pdf 107 | - 刮痧消百病 2014.pdf 108 | - 刮痧拔罐针灸 2015.pdf 109 | - 中医拔罐养生治病一本通 2011.pdf 110 | 111 | - 中医拔罐养生治病一本通 2011.pd 112 | 113 | - 图解刮痧·拔罐·艾灸养生疗法 2011.pdf 114 | 115 | - 李志刚教授之拔罐养生全程指导 (中医堂) 2014.pdf 116 | 117 | - 刮痧拔罐祛百病 (国医绝学健康馆) 2012.pdf 亚马逊4.0 153 介绍 118 | 119 | - 拔罐治病一招灵一招灵系列 -2009.pdf 120 | 121 | - 拔罐祛病看这本就够 2014.pdf 亚马逊4.5 40 介绍 122 | 123 | 124 | 125 | 126 | ### 偏方 127 | 128 | 中医偏方验方治百病 (家庭医学内参系列) 2011.pdf 129 | 130 | 中医传世老偏方宝宝疾病一扫光 -2013.pdf 亚马逊4星 9评论 131 | 132 | 中老年实用中医偏方妙方 (健康生活图书系列) 2010.pdf 133 | 134 | 一用就灵的名医偏方1000例(畅销升级版) (图说生活) - 2012.pdf 135 | 136 | 一本书读懂偏方验方治病 (医药科普丛书)一本书读懂偏方验方治病 (医药科普丛书) 2013.pdf 介绍 137 | 138 | 小偏方治大病:巧医妇科常见病 2014.pdf 介绍 139 | 140 | 小偏方治百病 (国医绝学健康馆) 2010.pdf 亚马逊4.5星 162评论 141 | 142 | 小偏方大功效 2013.pdf 143 | 144 | 外公是个老中医2--日常小病不用慌的经典老偏方- 2014.pdf 介绍 145 | 146 | 外公是个老中医:全家烦恼一扫光的经典老偏方 2013.pdf 介绍 147 | 148 | 实用偏方秘方 2007.pdf 149 | 150 | 偏方是最好的医生(双色版) (对症食疗速查金典) 2014.pdf 151 | 152 | 名医推荐家庭必备方剂从书:名医推荐家庭必备偏方 2015.pdf 153 | 154 | 民间乡野古方偏方4000首 - 2012.pdf 155 | 156 | 妈妈传下来的美颜小偏方:两代美女中医跨越30年的养颜精华 - 2012.pdf 介绍 157 | 158 | 老中医的传世小偏方:全家都能用的日常小病治疗秘方 2016.pdf 159 | 160 | 老偏方祛百病 (书立方·养生馆) 2012.pdf 161 | 162 | 很灵很灵的老偏方.112个女人健康美丽小偏方 - 2014.pdf 163 | 164 | 很老很老的老偏方大全集(10册) - 2015.pdf 亚马逊4.5星 13评论 165 | 166 | 超级汉方美人:200个经典古方全面提升美肌力 - 2013.pdf 167 | 168 | ### 急救 169 | 170 | 医疗急救指南 2009 4.5-4.pdf 171 | 172 | 生活急救一点通 2009 3.5-24.pdf 173 | 174 | 上海市红十字会现场急救培训教材•现场初级救护手册 2008 5-9.pdf 175 | 176 | 情绪急救应对各种日常心理伤害的策略与方法 2015 4.5 13.pdf 177 | 178 | 救护车到来前,你能做什么? 2016 4-10.pdf 179 | 180 | 紧急救助员实用应急技术 2008 3.5 2.pdf 介绍 181 | 182 | 家庭急救百问百答 (“金阳光”新农村丛书) 2010.pdf 183 | 184 | 急救方法与技术健康课堂 2008.pdf 185 | 186 | 儿童急救手册 2010 4-6.pdf 187 | 188 | ### 美容 189 | 190 | 美容养颜塑身瑜伽60式 (生活坊) - 2010 292 4.5.pdf 191 | 192 | 美啊,请你停一停中医体质美容使用手册 2012 4.5 11.pdf 193 | 194 | 皮肤组织病理学 (中国医师协会美容专业医师培训教材) 2013.pdf 195 | 196 | 自己是最好的美容师:一个八代中医世家的养生驻颜方 2011.pdf 197 | 198 | 我最想要的养颜美容书 2013 4.5 5.pdf 199 | 200 | 实用中医美容金方 2007.pdf 201 | 202 | 女性美容美体小百科 (女性健康小百科丛书) -2013.pdf 203 | 204 | 一万种美白方法:适合不同肤质、不同习惯、不同环境的科学美容美白大全 2014 4.5-58.pdf 205 | 206 | 专家教你做美容菜—女人美容养颜药膳 2013.pdf 207 | 208 | 中医美容专家指点 2003.pdf 209 | 210 | 中医美容养颜速查手册 2014.pdf 211 | 212 | 一万种补水方法:适合不同肤质、不同习惯、不同环境的科学美容补水大全 2014 4-263.pdf 213 | 214 | 实用皮肤美容学 2018.pdf 215 | 216 | 实用美容大全(第4版)- 2011.pdf 217 | 218 | 十分钟养生保健:美容瘦身指南 (10分钟养生保健) - 2014.pdf 219 | 220 | 生活智慧掌中宝32精油芳疗美容美体 - 2012 4-9.pdf 221 | 222 | 排毒美容养颜百科 2013.pdf 223 | 224 | 欧莱雅美容王国的财富传奇 2010.pdf 225 | 226 | 女性中医美容小全书(Mbook随身读) - 2013.pdf 227 | 228 | 女性美容护肤秘诀.pdf 229 | 230 | 内因决定外貌从丑小鸭到白天鹅的美容秘方 (每天美丽一点点系列) 2008 4-169.pdf 231 | 232 | 面部美容与整形 2007.pdf 233 | 234 | 美甲艺术教程 (中国美容高等教育系列教材) 2010.pdf 235 | 236 | 教你开个小本生活美容店为自己打工丛书 2013.pdf 237 | 238 | 国医精华·宫廷养生与美容 2009.pdf 239 | 240 | 爱美需要偏执——《时尚芭莎》美容专栏精选 2013.pdf 介绍 241 | 242 | 8090都在偷偷看的美容书 - 2015.pdf 243 | 244 | 超级汉方美人:200个经典古方全面提升美肌力 - 2013.pdf 245 | 246 | 247 | ### 其他 248 | 249 | 高血压、高血脂、高血糖对症食疗与按摩 (国医绝学健康馆) 2012 4.5 83.pdf 250 | 251 | 夫妻特效经络按摩图解 (国医绝学健康馆) 4.5 30.pdf 252 | 253 | 对症艾灸速查图典 2014.pdf 254 | 255 | 常见病自愈调养按摩 2015.pdf 256 | 257 | 常见病自愈调养艾灸 2012 4.5 34.pdf 258 | 259 | 本草对症养生茶饮 (国医绝学健康馆) 2012 4.5星 34评.pdf 260 | 261 | 宝宝常见病对症食疗与按摩 2012 4.5星 128评.pdf 262 | 263 | 百病从腿养 (国医绝学健康馆) 2012 4.5星 44评.pdf 264 | 265 | 艾灸特效穴位瘦身法 (她生活美体书系) 2014.pdf 266 | 267 | 艾灸祛病看这本就够 2012 4.5星 41评.pdf 268 | 269 | 艾灸疗法治百病(第2版) (中国民间传统疗法丛书) - 2009.pdf 270 | 271 | 图解掌纹健康密码 - 2010.pdf 介绍 272 | 273 | 274 | ## 保健 275 | 276 | [图解八段锦、五禽戏、易筋经-《国医绝学健康馆》编委会.pdf](https://itbooks.pipipan.com/fs/18113597-313704156) 277 | 278 | [“三高”怎么吃怎么养](https://sn9.us/file/18113597-410429507) 279 | 280 | [新型冠状病毒感染的肺炎公众防护指南.pdf](https://sn9.us/file/18113597-422639269) 281 | 282 | [新型冠状病毒感染的肺炎防治知识手册](https://sn9.us/file/18113597-422639242) -------------------------------------------------------------------------------- /知名公司面试题.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## 1谷歌笔试题:break与try 4 | 5 | 请问以下代码的输出是什么? 6 | 7 | ```python 8 | try: 9 | for i in range(3): 10 | try: 11 | 1 / 0 12 | except ZeroDivisionError: 13 | raise ZeroDivisionError("Error: You divided by zero!") 14 | finally: 15 | print("Finally executed") 16 | break 17 | except ZeroDivisionError: 18 | print("Outer ZeroDivisionError exception caught") 19 | 20 | ``` 21 | 22 | - A 23 | 24 | Outer ZeroDivisionError exception caught 25 | 26 | - B 27 | Error: You divided by zero! 28 | 29 | - C 30 | 31 | Error: You divided by zero! 32 | Finally executed 33 | 34 | - D 35 | 36 | Finally executed 37 | - E 38 | 39 | None of the above 40 | 41 | 答案:D 42 | 43 | ## 2Netflix面试题range 44 | 45 | 请问以下代码的输出及output的类型? 46 | 47 | ```python 48 | numbers = range(3) 49 | output = {*numbers} 50 | print(output) 51 | 52 | ``` 53 | 54 | 答案: 55 | 56 | 输出:{0, 1, 2} 57 | 58 | 类型:集合 59 | 60 | 61 | ## 3Netflix面试题format 62 | 63 | 64 | 请问以下代码的输出及output的类型? 65 | 66 | ```python 67 | print("{2}, {1}, {0}".format(*"abc")) 68 | ``` 69 | 70 | 答案:c, b, a 71 | 72 | ## 4谷歌笔试题:int与bool 73 | 74 | 请问以下代码的输出 75 | 76 | ```python 77 | my_list = [True, 1, "python", 5, False, {}, True] 78 | integers_found = 0 79 | bools_found = 0 80 | 81 | for item in my_list: 82 | if isinstance(item, int): 83 | integers_found += 1 84 | elif isinstance(item, bool): 85 | bools_found += 1 86 | 87 | print(f"{integers_found = } {bools_found = }") 88 | ``` 89 | 90 | 91 | 92 | 答案:integers_found = 5 bools_found = 0 93 | 94 | ## 5谷歌笔试题:int与bool 95 | 96 | 请问以下代码的输出 97 | 98 | ```python 99 | print(sum([ 100 | all([[]]), 101 | all([]), 102 | all([[[]]]) 103 | ])) 104 | ``` 105 | 106 | 答案:2 107 | 108 | 109 | ## 6某国内上市公司笔试题:列表表达式 110 | 111 | 请问以下代码的输出 112 | 113 | ```python 114 | print([x for x in range(10) if x % 2]) 115 | ``` 116 | 117 | 答案:[1, 3, 5, 7, 9] 118 | 119 | 120 | ## 7某国内上市公司笔试题:zip 121 | 122 | 请问以下代码的输出 123 | 124 | ```python 125 | numbers = [1, 2, 3, 4, 5] 126 | letters = ["a", "b", "c"] 127 | print(list(zip(numbers, letters))) 128 | ``` 129 | 130 | 答案:[(1, 'a'), (2, 'b'), (3, 'c')] 131 | 132 | - 补充知识 133 | 134 | ```python 135 | >>> from itertools import zip_longest 136 | >>> list(zip_longest(numbers, letters)) 137 | [(1, 'a'), (2, 'b'), (3, 'c'), (4, None), (5, None)] 138 | 139 | >>> list(zip_longest(numbers, letters, fillvalue="Python")) 140 | [(1, 'a'), (2, 'b'), (3, 'c'), (4, 'Python'), (5, 'Python')] 141 | ``` 142 | 143 | ## 8Netflix笔试题:列表pop 144 | 145 | 请问以下代码的输出 146 | 147 | ```python 148 | my_list = list(range(1, 7)) 149 | for index, item in enumerate(my_list): my_list.pop(index) 150 | print(my_list) 151 | ``` 152 | 153 | 答案:[2, 4, 6] 154 | 155 | 156 | ## 8某国内上市公司笔试题:解包 157 | 158 | 请问以下代码的输出 159 | 160 | ```python 161 | a, *b, c = [1, 2, 3, 4, 5] 162 | print(b) 163 | ``` 164 | 165 | 答案:[2, 3, 4] 166 | 167 | ## 9某国内上市公司笔试题:lambda 168 | 169 | 请问以下代码的输出 170 | 171 | ```python 172 | print((lambda a, b: a * b)(5, 4) - True) 173 | ``` 174 | 175 | 答案:19 176 | 177 | 178 | ## 10某国内上市公司笔试题:交集 179 | 180 | 请问以下代码的输出 181 | 182 | ```python 183 | names = {"Mike", "Pinky", "Brain", "Dot"} 184 | other_names = {"Brain", "Yakko", "Wacko", "Rita"} 185 | print(names & other_names) 186 | ``` 187 | 188 | 答案:{'Brain'} 189 | 190 | - 补充知识 191 | 192 | 等同于: 193 | ```python 194 | >>> names.intersection(other_names) 195 | {'Brain'} 196 | ``` 197 | 198 | ## 11某国内上市公司笔试题:差集 199 | 200 | 请问以下代码的输出 201 | 202 | ```python 203 | names = {"Mike", "Pinky", "Brain", "Dot"} 204 | other_names = {"Brain", "Yakko", "Wacko", "Rita"} 205 | print(names - other_names) 206 | ``` 207 | 208 | 答案:{'Dot', 'Mike', 'Pinky'} 209 | 210 | - 补充知识 211 | 212 | 等同于: 213 | ```python 214 | >>> names.difference(other_names) 215 | {'Pinky', 'Mike', 'Dot'} 216 | ``` 217 | 218 | ## 12某国内上市公司笔试题:嵌套三元表达式 219 | 220 | 请问以下代码的输出 221 | 222 | ```python 223 | A = False 224 | B = True 225 | print("one" if A else "Python" if B else "Ciao!") 226 | ``` 227 | 228 | 答案:Python 229 | 230 | - 补充知识 231 | 232 | 等同于: 233 | ```python 234 | >>> names.difference(other_names) 235 | {'Pinky', 'Mike', 'Dot'} 236 | ``` 237 | 238 | ## 13某国内上市公司笔试题:嵌套三元表达式 239 | 240 | 请问以下代码的输出 241 | 242 | ```python 243 | A = False 244 | B = True 245 | print("one" if A else "Python" if B else "Ciao!") 246 | ``` 247 | 248 | 答案:Python 249 | 250 | - 补充知识 251 | 252 | 等同于: 253 | ```python 254 | >>> names.difference(other_names) 255 | {'Pinky', 'Mike', 'Dot'} 256 | ``` 257 | 258 | ## 14微软笔试题:类型相乘 259 | 260 | 请问以下哪些操作会引发异常: 261 | 262 | - A 5 * True 263 | 264 | - B 5 * "Spam" 265 | 266 | - C 5 * [1, 2] 267 | 268 | - D 5 * None 269 | 270 | - E C and D 271 | 272 | 273 | 答案:D 274 | 275 | 276 | ## 15某国内上市公司笔试题:fstring 277 | 278 | 请问以下代码的输出 279 | 280 | ```python 281 | message = "hi" 282 | fill = "s" 283 | align = "<" 284 | width = 10 285 | print(f"{message:{fill}{align}{width}}") 286 | ``` 287 | 288 | 答案:hissssssss 289 | 290 | 291 | ## 16某国内上市公司笔试题:fstring-date 292 | 293 | 请问以下代码的输出 294 | 295 | ```python 296 | import datetime 297 | 298 | day = datetime.datetime(2021, 11, 20) 299 | print(f"{day} was a {day:%A}") 300 | ``` 301 | 302 | 答案:2021-11-20 00:00:00 was a Saturday 303 | 304 | ## 17某国内上市公司笔试题:fstring-浮点数 305 | 306 | 请问以下代码的输出 307 | 308 | ```python 309 | number = 10.125 310 | print(f"{round(number):.2f}") 311 | ``` 312 | 313 | 答案:10.00 314 | 315 | ## 18某国内上市公司笔试题:字典解包 316 | 317 | 请问以下代码的输出 318 | 319 | ```python 320 | my_dict = {1: "Charles", 2: "Babbage"} 321 | print(*my_dict) 322 | ``` 323 | 324 | 答案:1 2 325 | 326 | ## 19某国内上市公司笔试题:海象操作符 327 | 328 | 请问以下代码的输出 329 | 330 | ```python 331 | (a := 6, 9) 332 | (a, b := 16, 19) 333 | print(f"{a=} {b=}") 334 | ``` 335 | 336 | 答案:a=6 b=16 337 | 338 | ## 20某国内上市公司笔试题:callable 339 | 340 | 请问以下代码的输出 341 | 342 | ```python 343 | objects = [int, "", 1, str] 344 | print([callable(obj) for obj in objects]) 345 | ``` 346 | 347 | 答案:[True, False, False, True] 348 | 349 | ## 21某国内上市公司笔试题:dict_key 350 | 351 | 请问以下代码的输出 352 | 353 | ```python 354 | languages = {} 355 | languages[1.1] = "C++" 356 | languages[2.0] = "PHP" 357 | languages[2] = "Python" 358 | print(languages) 359 | ``` 360 | 361 | 答案:{1.1: 'C++', 2.0: 'Python'} 362 | 363 | 364 | ## 22Zoom笔试题:列表突变 365 | 366 | 请问以下代码的输出 367 | 368 | ```python 369 | my_list = list(range(1, 7)) 370 | my_list = my_list.append(8) 371 | print(my_list) 372 | ``` 373 | 374 | 答案:None 375 | 376 | ## 23某国内上市公司笔试题:fstring_numbers 377 | 378 | 请问以下代码的输出 379 | 380 | ```python 381 | number = 12 382 | print(f"int: {number:d}; hex: {number:02X}; oct: {number:o}; bin: {number:b} ") 383 | ``` 384 | 385 | 答案:int: 12; hex: 0C; oct: 14; bin: 1100 386 | 387 | 388 | ## 24Zoom笔试题:一行代码实现字符串反转 389 | 390 | 请问以下代码的输出 391 | 392 | ```python 393 | print("Python"[::-1]) 394 | ``` 395 | 答案:nohtyP 396 | 397 | ## 25-Zoom面试题:请简述python迭代器 398 | 399 | 参考答案: 400 | 401 | 迭代器就是一个拥有 next()和 done()方法的对象,后者在序列中没有其他元素时返回 True。 402 | 403 | 每次对迭代器调用next()方法,会按照顺序返回可迭代对象的另一个元素。最终迭代器将会耗尽(没有更多元素可以返回),这时会抛出 Stopiteration 异常,就此停止循环。 404 | 405 | ## 26-Zoom面试题:请简述python推导 406 | 407 | 参考答案: 408 | 409 | 推导可以在一行代码中实现对可迭代对象的转换或过滤。返回的对象可以是非常正常的列表、集合或字典,或者是可以一次性用掉的生成器表达式。 --------------------------------------------------------------------------------