{"id":68869,"date":"2021-05-17T22:45:33","date_gmt":"2021-05-17T14:45:33","guid":{"rendered":"http:\/\/www.zhushiyao.com\/?p=68869"},"modified":"2021-05-17T22:46:56","modified_gmt":"2021-05-17T14:46:56","slug":"54fdec2119","status":"publish","type":"post","link":"http:\/\/www.zhushiyao.com\/?p=68869","title":{"rendered":"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)"},"content":{"rendered":"<div class=\"bpp-post-content\">\n<section style=\"white-space: normal; font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.51px; background-color: #ffffff;\">\n<section style=\"display: flex; justify-content: center; align-items: center; width: 677px;\">\n<section style=\"display: flex; justify-content: flex-start; align-items: center; flex-direction: column;\">\n<section style=\"margin-bottom: -37px; margin-left: -21px; width: 21px; height: 38px; display: flex; justify-content: center; align-items: center; align-self: flex-start; z-index: 1;\"><br \/><img decoding=\"async\" style=\"box-sizing: border-box !important; visibility: visible !important; width: 21px !important;\" src=\"https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/lpHDr05YrIRQgT2sib9SWGE99gWsPW7x8FP6LoMYvgkmO9jSQjFqfcMVBUsiaSKickqickc7k2Kwah52tbzMnA316k2WA88rXLAX\/640?wx_fmt=svg\" \/><\/section>\n<\/section>\n<\/section>\n<\/section>\n<p style=\"white-space: normal; text-align: right;\"><span style=\"font-size: 14px; color: #888888;\">\u4f5c\u8005\uff1a\u5927\u6c5f\u72d7<\/span><\/p>\n<p style=\"white-space: normal; text-align: right;\"><span style=\"font-size: 14px; color: #888888;\">\u6765\u6e90\uff1aPython Web\u4e0eDjango\u5f00\u53d1<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u5927\u5bb6\u597d\uff0c\u6211\u662f\u732b\u54e5\u3002\u4eca\u5929\u5206\u4eab\u4e00\u7bc7\u6587\u7ae0\uff0c\u4f5c\u8005\u5229\u7528Django 3.0 +Redis 3.4 +Celery 4.4\u5f00\u53d1\u4e86\u4e2a\u5c0f\u5e94\u7528\u3002\u5e94\u7528\u4e0d\u590d\u6742\uff0c\u4f46\u77e5\u8bc6\u70b9\u5f88\u591a\uff0c\u975e\u5e38\u9002\u5408\u65b0\u624b\u7ec3\u624b\u3002\u9879\u76ee\u9700\u6c42\u5982\u4e0b\uff1a<\/span><\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-left: 30px; width: 577.188px; white-space: normal; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\">\n<li style=\"font-size: 14px;\">\n<p style=\"margin-bottom: 0.5rem; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem;\">\u521b\u5efa\u4e24\u4e2a\u9875\u9762\uff0c\u4e00\u4e2a\u7528\u4e8e\u521b\u5efa\u9875\u9762\uff0c\u4e00\u4e2a\u7528\u4e8e\u52a8\u6001\u5c55\u793a\u9875\u9762\u8be6\u60c5\uff0c\u5e76\u63d0\u4f9b\u9759\u6001HMTL\u6587\u4ef6\u94fe\u63a5<\/p>\n<\/li>\n<li style=\"font-size: 14px;\">\n<p style=\"margin-bottom: 0.5rem; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem;\">\u4e00\u4e2a\u9875\u9762\u521b\u5efa\u5b8c\u6210\u540e\uff0c\u4f7f\u7528Celery\u5f02\u6b65\u6267\u884c\u751f\u6210\u9759\u6001HTML\u6587\u4ef6\u7684\u4efb\u52a1<\/p>\n<\/li>\n<li style=\"font-size: 14px;\">\n<p style=\"margin-bottom: 0.5rem; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem;\">\u4f7f\u7528redis\u4f5c\u4e3aCelery\u7684Broker<\/p>\n<\/li>\n<li style=\"font-size: 14px;\">\n<p style=\"margin-bottom: 0.5rem; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem;\">\u4f7f\u7528flower\u76d1\u63a7Celery\u5f02\u6b65\u4efb\u52a1\u6267\u884c\u60c5\u51b5<\/p>\n<\/li>\n<\/ul>\n<p style=\"white-space: normal; text-align: center;\"><img decoding=\"async\" class=\"rich_pages\" style=\"display: inline;\" title=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/05\/6-1621262733.png\" alt=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" \/><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u9879\u76ee\u5b8c\u6210\u540e\u6f14\u793a\u89c1\u4e0b\u9762\u52a8\u753b\u3002\u672c\u9879\u76ee\u7684GitHub\u6e90\u7801\u5730\u5740\u5728\u6700\u540e\uff0c\u8bf7\u8010\u5fc3\u9605\u8bfb\u3002<\/span><\/p>\n<p style=\"white-space: normal; text-align: center;\"><img decoding=\"async\" class=\"rich_pages\" title=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/05\/7-1621262734.gif\" alt=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" \/><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\">\u00a0<\/p>\n<h3 style=\"margin-top: 20px; margin-bottom: 7px; font-weight: bold; font-size: 1.4rem; break-after: avoid-page; break-inside: avoid; line-height: 1.43; cursor: text; white-space: pre-wrap; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; text-align: start;\"><span style=\"font-size: 14px;\">\u7b2c\u96f6\u6b65\uff1apip\u8bbe\u7f6e\u56fd\u5185\u6e90<\/span><\/h3>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u56fd\u5185\u7528\u6237\u4f7f\u7528pip\u5b89\u88c5python\u5305\u7279\u522b\u6162\uff0c\u8fd9\u4e3b\u8981\u662f\u5e94\u4e3a\u56fd\u5185\u8fde\u63a5\u56fd\u5916\u7f51\u7edc\u4e0d\u7a33\u5b9a\u3002\u4e3a\u52a0\u901fpython\u5305\u7684\u5b89\u88c5\uff0c\u9996\u5148\u5c06pip\u5b89\u88c5\u6e90\u8bbe\u7f6e\u4e3a\u56fd\u5185\u7684\u955c\u50cf\uff0c\u6bd4\u5982\u963f\u91cc\u4e91\u63d0\u4f9b\u7684\u955c\u50cf\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\"><strong style=\"padding-right: 1px; padding-left: 1px;\"><em style=\"padding-right: 5px; padding-left: 2px;\">linux<\/em>\u7cfb\u7edf<\/strong>\u4fee\u6539 ~\/.pip\/pip.conf (\u6ca1\u6709\u5c31\u521b\u5efa\u4e00\u4e2a)\uff0c \u5185\u5bb9\u5982\u4e0b\uff1a<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">[global]index-url = <span style=\"word-break: break-all;\" spellcheck=\"false\">https:\/\/mirrors.aliyun.com\/pypi\/simple\/<\/span> <\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\"><strong style=\"padding-right: 1px; padding-left: 1px;\"><em style=\"padding-right: 5px; padding-left: 2px;\">windows\u7cfb\u7edf<\/em><\/strong>\u76f4\u63a5\u5728user\u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2apip\u76ee\u5f55\uff0c\u5982\uff1aC:Usersxxpip\uff0c\u65b0\u5efa\u6587\u4ef6pip.ini\uff0c\u5185\u5bb9\u5982\u4e0b:<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">[global]index-url = <span style=\"word-break: break-all;\" spellcheck=\"false\">http:\/\/mirrors.aliyun.com\/pypi\/simple\/<\/span><\/span><\/p>\n<h3 style=\"margin-top: 20px; margin-bottom: 7px; font-weight: bold; font-size: 1.4rem; break-after: avoid-page; break-inside: avoid; line-height: 1.43; cursor: text; white-space: pre-wrap; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; text-align: start;\"><span style=\"font-size: 14px;\">\u7b2c\u4e00\u6b65\uff1a\u5b89\u88c5Django\u5e76\u521b\u5efa\u9879\u76eemyproject<\/span><\/h3>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u4f7f\u7528pip\u547d\u4ee4\u5b89\u88c5Django.<\/span><\/p>\n<pre lang=\"bash\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">pip install django==3.0.4 # \u5b89\u88c5Django\uff0c\u6240\u7528\u7248\u672c\u4e3a3.0.4<\/span><\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u4f7f\u7528django-admin startproject myproject\u521b\u7acb\u4e00\u4e2a\u540d\u4e3amyproject\u7684\u9879\u76ee<\/span><\/p>\n<pre lang=\"bash\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">django-admin startproject myproject<\/span><\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u6574\u4e2a\u9879\u76ee\u5b8c\u6574\u76ee\u5f55\u673a\u6784\u5982\u4e0b\u6240\u793a, \u9879\u76ee\u540d\u4e3amyproject, staticpage\u4e3aapp\u540d\u3002<\/span><\/p>\n<p style=\"white-space: normal; text-align: center;\"><img decoding=\"async\" class=\"rich_pages\" title=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/05\/7-1621262734.png\" alt=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" \/><\/p>\n<h3 style=\"margin-top: 20px; margin-bottom: 7px; font-weight: bold; font-size: 1.4rem; break-after: avoid-page; break-inside: avoid; line-height: 1.43; cursor: text; white-space: pre-wrap; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; text-align: start;\"><span style=\"font-size: 14px;\">\u7b2c\u4e8c\u6b65\uff1a\u5b89\u88c5redis\u548c\u9879\u76ee\u4f9d\u8d56\u7684\u7b2c\u4e09\u65b9\u5305<\/span><\/h3>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u9879\u76ee\u4e2d\u6211\u4eec\u9700\u8981\u4f7f\u7528redis\u505aCelery\u7684\u4e2d\u95f4\u4eba(Broker), \u6240\u4ee5\u9700\u8981\u5148\u5b89\u88c5redis\u6570\u636e\u5e93\u3002redis\u7f51\u4e0a\u6559\u7a0b\u5f88\u591a\uff0c\u8fd9\u91cc\u5c31\u7b80\u8981\u5e26\u8fc7\u4e86\u3002<\/span><\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-left: 30px; width: 577.188px; white-space: normal; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\">\n<li style=\"font-size: 14px;\">\n<p style=\"margin-bottom: 0.5rem; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem;\"><strong style=\"padding-right: 1px; padding-left: 1px;\">Windows\u4e0b\u8f7d\u5730\u5740\uff1a<\/strong><span style=\"word-break: break-all;\" spellcheck=\"false\">https:\/\/github.com\/MSOpenTech\/redis\/releases<\/span><\/p>\n<\/li>\n<li style=\"font-size: 14px;\">\n<p style=\"margin-bottom: 0.5rem; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem;\"><strong style=\"padding-right: 1px; padding-left: 1px;\">Linux\u4e0b\u5b89\u88c5\uff08Ubuntu\u7cfb\u7edf)<\/strong>\uff1a$ sudo apt-get install redis-server<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u672c\u9879\u76ee\u8fd8\u9700\u8981\u5b89\u88c5\u5982\u4e0b\u4f9d\u8d56\u5305\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528pip\u547d\u4ee4\u9010\u4e00\u5b89\u88c5\u3002<\/span><\/p>\n<pre lang=\"bash\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">pip install redis==3.4.1<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">pip install celery==4.4.2<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">pip install eventlet # celery 4.0+\u7248\u672c\u4ee5\u540e\u4e0d\u652f\u6301\u5728windows\u8fd0\u884c\uff0c\u8fd8\u9700\u989d\u5916\u5b89\u88c5eventlet\u5e93<\/span><\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u4f60\u8fd8\u53ef\u4ee5myproject\u76ee\u5f55\u4e0b\u65b0\u5efa<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">requirements.txt<\/code>\u52a0\u5165\u6240\u4f9d\u8d56\u7684python\u5305\u53ca\u7248\u672c\uff0c\u7136\u540e\u4f7f\u7528<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">pip install -r requirements.txt<\/code>\u547d\u4ee4\u5b89\u88c5\u6240\u6709\u4f9d\u8d56\u3002\u672c\u6559\u7a0b\u6240\u4f7f\u7528\u7684django, redis\u548ccelery\u5747\u4e3a\u6700\u65b0\u7248\u672c\u3002<\/span><\/p>\n<pre lang=\"\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">django==3.0.5<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">redis==3.4.1<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">celery==4.4.2 \u00a0<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">eventlet # for windows only<\/span><\/pre>\n<h3 style=\"margin-top: 20px; margin-bottom: 7px; font-weight: bold; font-size: 1.4rem; break-after: avoid-page; break-inside: avoid; line-height: 1.43; cursor: text; white-space: pre-wrap; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; text-align: start;\"><span style=\"font-size: 14px;\">\u7b2c\u4e09\u6b65\uff1aCelery\u57fa\u672c\u914d\u7f6e<\/span><\/h3>\n<ol class=\"list-paddingleft-2\" style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-left: 30px; width: 577.188px; white-space: normal; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\" start=\"\">\n<li style=\"padding-left: 0.5rem;\">\n<p style=\"margin-bottom: 0.5rem; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem;\"><span style=\"font-size: 14px;\">\u4fee\u6539<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">settings.py<\/code>\u65b0\u589ecelery\u6709\u5173\u7684\u914d\u7f6e\u3002celery\u9ed8\u8ba4\u4e5f\u662f\u6709\u81ea\u5df1\u7684\u914d\u7f6e\u6587\u4ef6\u7684\uff0c\u540d\u4e3a<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">celeryconfig.py<\/code>, \u4f46\u7531\u4e8e\u7ba1\u7406\u591a\u4e2a\u914d\u7f6e\u6587\u4ef6\u5f88\u9ebb\u70e6\uff0c\u6211\u4eec\u628acelery\u7684\u914d\u7f6e\u53c2\u6570\u4e5f\u5199\u5728django\u7684\u914d\u7f6e\u6587\u4ef6\u91cc\u3002<\/span><\/p>\n<\/li>\n<\/ol>\n<pre lang=\"python\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u914d\u7f6ecelery\u65f6\u533a\uff0c\u9ed8\u8ba4\u65f6UTC\u3002<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">if USE_TZ:<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0timezone = TIME_ZONE<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># celery\u914d\u7f6eredis\u4f5c\u4e3abroker\u3002redis\u670916\u4e2a\u6570\u636e\u5e93\uff0c\u7f16\u53f70~15\uff0c\u8fd9\u91cc\u4f7f\u7528\u7b2c1\u4e2a\u3002<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">broker_url = 'redis:\/\/127.0.0.1:6379\/0'<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u8bbe\u7f6e\u5b58\u50a8\u7ed3\u679c\u7684\u540e\u53f0<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">result_backend = 'redis:\/\/127.0.0.1:6379\/0'<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u53ef\u63a5\u53d7\u7684\u5185\u5bb9\u683c\u5f0f<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">accept_content = [\"json\"]<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u4efb\u52a1\u5e8f\u5217\u5316\u6570\u636e\u683c\u5f0f<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">task_serializer = \"json\"<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u7ed3\u679c\u5e8f\u5217\u5316\u6570\u636e\u683c\u5f0f<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">result_serializer = \"json\"<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u53ef\u9009\u53c2\u6570\uff1a\u7ed9\u67d0\u4e2a\u4efb\u52a1\u9650\u6d41<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># task_annotations = {'tasks.my_task': {'rate_limit': '10\/s'}}<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u53ef\u9009\u53c2\u6570\uff1a\u7ed9\u4efb\u52a1\u8bbe\u7f6e\u8d85\u65f6\u65f6\u95f4\u3002\u8d85\u65f6\u7acb\u5373\u4e2d\u6b62worker<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># task_time_limit = 10 * 60<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u53ef\u9009\u53c2\u6570\uff1a\u7ed9\u4efb\u52a1\u8bbe\u7f6e\u8f6f\u8d85\u65f6\u65f6\u95f4\uff0c\u8d85\u65f6\u629b\u51faException<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># task_soft_time_limit = 10 * 60<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u53ef\u9009\u53c2\u6570\uff1a\u5982\u679c\u4f7f\u7528django_celery_beat\u8fdb\u884c\u5b9a\u65f6\u4efb\u52a1<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># beat_scheduler = \"django_celery_beat.schedulers:DatabaseScheduler\"<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u66f4\u591a\u9009\u9879\u89c1<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># https:\/\/docs.celeryproject.org\/en\/stable\/userguide\/configuration.html<\/span><\/pre>\n<ol class=\"list-paddingleft-2\" style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-left: 30px; width: 577.188px; white-space: normal; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\" start=\"2\">\n<li style=\"padding-left: 0.5rem;\">\n<p style=\"margin-bottom: 0.5rem; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem;\"><span style=\"font-size: 14px;\">\u5728<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">settings.py<\/code>\u540c\u7ea7\u76ee\u5f55\u4e0b\u65b0\u5efa<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">celery.py<\/code>\uff0c\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9:<\/span><\/p>\n<\/li>\n<\/ol>\n<pre lang=\"python\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># coding:utf-8<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from __future__ import absolute_import, unicode_literals<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">import os<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from celery import Celery<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u6307\u5b9aDjango\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\u6a21\u5757<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u4e3a\u6211\u4eec\u7684\u9879\u76eemyproject\u521b\u5efa\u4e00\u4e2aCelery\u5b9e\u4f8b\u3002\u8fd9\u91cc\u4e0d\u6307\u5b9abroker\u5bb9\u6613\u51fa\u73b0\u9519\u8bef\u3002<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">app = Celery('myproject', broker='redis:\/\/127.0.0.1:6379\/0')<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u8fd9\u91cc\u6307\u5b9a\u4ecedjango\u7684settings.py\u91cc\u8bfb\u53d6celery\u914d\u7f6e<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">app.config_from_object('django.conf:settings')<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u81ea\u52a8\u4ece\u6240\u6709\u5df2\u6ce8\u518c\u7684django app\u4e2d\u52a0\u8f7d\u4efb\u52a1<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">app.autodiscover_tasks()<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u7528\u4e8e\u6d4b\u8bd5\u7684\u5f02\u6b65\u4efb\u52a1<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">@app.task(bind=True)<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">def debug_task(self):<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0print('Request: {0!r}'.format(self.request))<\/span><br \/>\u00a0<br \/>\u00a0<\/pre>\n<ol class=\"list-paddingleft-2\" style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-left: 30px; width: 577.188px; white-space: normal; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\" start=\"3\">\n<li style=\"padding-left: 0.5rem;\">\n<p style=\"margin-bottom: 0.5rem; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem;\"><span style=\"font-size: 14px;\">\u6253\u5f00<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">settings.py<\/code>\u540c\u7ea7\u76ee\u5f55\u4e0b\u7684<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">__init__.py<\/code>\uff0c\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9, \u786e\u4fdd\u9879\u76ee\u542f\u52a8\u65f6\u5373\u52a0\u8f7dCelery\u5b9e\u4f8b<\/span><\/p>\n<\/li>\n<\/ol>\n<pre lang=\"\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># coding:utf-8<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from __future__ import absolute_import, unicode_literals<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u5f15\u5165celery\u5b9e\u4f8b\u5bf9\u8c61<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from .celery import app as celery_app<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">__all__ = ('celery_app',)<\/span><\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u7f51\u4e0a\u5f88\u591adjango redis + celery\u7684\u6559\u7a0b\u6bd4\u8f83\u8001\u4e86, \u5751\u5f88\u591a\u3002\u6bd4\u5982\u65b0\u7248\u539f\u751f\u7684Celery\u5df2\u7ecf\u652f\u6301Django\u4e86\uff0c\u4e0d\u9700\u8981\u518d\u501f\u52a9\u4ec0\u4e48django-celery\u548ccelery-with-redis\u8fd9\u79cd\u7b2c\u4e09\u65b9\u5e93\u4e86, \u914d\u7f6e\u53c2\u6570\u540d\u4e5f\u7531\u5927\u5199\u53d8\u6210\u4e86\u5c0f\u5199\uff0c\u65e0\u9700\u518d\u52a0CELERY\u524d\u7f00\u3002\u53e6\u5916\u5f53\u4f60\u901a\u8fc7<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">app = Celery('myproject')<\/code>\u521b\u5efaCelery\u5b9e\u4f8b\u65f6\u5982\u679c\u4e0d\u6307\u5b9aBroker\uff0c\u5f88\u5bb9\u6613\u51fa\u73b0<em style=\"padding-right: 5px; padding-left: 2px;\">[ERROR\/MainProcess] consumer: Cannot connect to amqp:\/\/guest:**@127.0.0.1:5672\/\/: [Errno 111] Connection refused<\/em>\u8fd9\u4e2a\u9519\u8bef\u3002<\/span><\/p>\n<h3 style=\"margin-top: 20px; margin-bottom: 7px; font-weight: bold; font-size: 1.4rem; break-after: avoid-page; break-inside: avoid; line-height: 1.43; cursor: text; white-space: pre-wrap; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; text-align: start;\"><span style=\"font-size: 14px;\">\u7b2c\u56db\u6b65\uff1a\u542f\u52a8redis\uff0c\u6d4b\u8bd5celery\u662f\u5426\u914d\u7f6e\u6210\u529f<\/span><\/h3>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u5728Django\u4e2d\u7f16\u5199\u548c\u6267\u884c\u81ea\u5df1\u7684\u5f02\u6b65\u4efb\u52a1\u524d\uff0c\u4e00\u5b9a\u8981\u5148\u6d4b\u8bd5redis\u548ccelery\u662f\u5426\u5b89\u88c5\u597d\u5e76\u914d\u7f6e\u6210\u529f\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u9996\u5148\u4f60\u8981\u542f\u52a8redis\u670d\u52a1\u3002windows\u8fdb\u5165redis\u6240\u5728\u76ee\u5f55\uff0c\u4f7f\u7528<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">redis-server.exe<\/code>\u542f\u52a8redis\u3002Linux\u4e0b\u4f7f\u7528<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">.\/redis-server redis.conf<\/code>\u542f\u52a8\uff0c\u4e5f\u53ef\u4fee\u6539redis.conf\u5c06daemonize\u8bbe\u7f6e\u4e3ayes, \u786e\u4fdd\u5b88\u62a4\u8fdb\u7a0b\u5f00\u542f\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u542f\u52a8redis\u670d\u52a1\u540e\uff0c\u4f60\u8981\u5148\u8fd0\u884c<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">python manage.py runserver<\/code>\u547d\u4ee4\u542f\u52a8Django\u670d\u52a1\u5668\uff08\u65e0\u9700\u521b\u5efa\u4efb\u4f55app)\uff0c\u7136\u540e\u518d\u6253\u5f00\u4e00\u4e2a\u7ec8\u7aefterminal\u7a97\u53e3\u8f93\u5165celery\u547d\u4ee4\uff0c\u542f\u52a8worker\u3002<\/span><\/p>\n<pre lang=\"\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># Linux\u4e0b\u6d4b\u8bd5<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">Celery -A myproject worker -l info<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># Windows\u4e0b\u6d4b\u8bd5<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">Celery -A myproject worker -l info -P eventlet<\/span><\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u5982\u679c\u4f60\u80fd\u770b\u5230[tasks]\u4e0b\u6240\u5217\u5f02\u6b65\u4efb\u52a1\u6e05\u5355\u5982debug_task\uff0c\u4ee5\u53ca\u6700\u540e\u4e00\u53e5celery@xxxx ready, \u8bf4\u660e\u4f60\u7684redis\u548ccelery\u90fd\u914d\u7f6e\u597d\u4e86\uff0c\u53ef\u4ee5\u5f00\u59cb\u6b63\u5f0f\u5de5\u4f5c\u4e86\u3002<\/span><\/p>\n<pre lang=\"bash\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">-------------- celery@DESKTOP-H3IHAKQ v4.4.2 (cliffs)<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">--- ***** -----<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">-- ******* ---- Windows-10-10.0.18362-SP0 2020-04-24 22:02:38<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">- *** --- * ---<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">- ** ---------- [config]<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">- ** ---------- .&gt; app: \u00a0 \u00a0 \u00a0 \u00a0 myproject:0x456d1f0<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">- ** ---------- .&gt; transport: \u00a0 redis:\/\/127.0.0.1:6379\/0<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">- ** ---------- .&gt; results: \u00a0 \u00a0 redis:\/\/localhost:6379\/0<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">- *** --- * --- .&gt; concurrency: 4 (eventlet)<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0-- ******* ---- .&gt; task events: OFF (enable -E to monitor tasks in this worker)<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0--- ***** -----<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 -------------- [queues]<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 .&gt; celery \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 exchange=celery(direct) key=celery<\/span><br \/>\u00a0<br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">[tasks]<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0. myproject.celery.debug_task<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">[2020-04-24 22:02:38,484: INFO\/MainProcess] Connected to redis:\/\/127.0.0.1:6379\/0<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">[2020-04-24 22:02:38,500: INFO\/MainProcess] mingle: searching for neighbors<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">[2020-04-24 22:02:39,544: INFO\/MainProcess] mingle: all alone<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">[2020-04-24 22:02:39,572: INFO\/MainProcess] pidbox: Connected to redis:\/\/127.0.0.1:6379\/0.<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">[2020-04-24 22:02:39,578: WARNING\/MainProcess] c:usersmissenkapycharmprojectsdjango-static-html-generatorvenvlibsite-packagesceleryfixupsdjango.py:203: UserWarning: Using sett<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">ings.DEBUG leads to a memory<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 leak, never use this setting in production environments!<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0leak, never use this setting in production environments!''')<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">[2020-04-24 22:02:39,579: INFO\/MainProcess] celery@DESKTOP-H3IHAKQ ready.<\/span><\/pre>\n<h3 style=\"margin-top: 20px; margin-bottom: 7px; font-weight: bold; font-size: 1.4rem; break-after: avoid-page; break-inside: avoid; line-height: 1.43; cursor: text; white-space: pre-wrap; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; text-align: start;\"><span style=\"font-size: 14px;\">\u7b2c\u4e94\u6b65\uff1aDjango\u4e2d\u521b\u5efa\u65b0\u5e94\u7528staticpage<\/span><\/h3>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">cd\u8fdb\u5165<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">myproject<\/code>\u6587\u4ef6\u5939\uff0c\u4f7f\u7528<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">python manage.py startapp staticpage<\/code>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">staticpage<\/code>\u7684app\u3002\u6211\u4eec\u5c06\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684<\/span><span style=\"font-size: 12px;\"><code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">Page<\/code><\/span><span style=\"font-size: 14px;\">\u6a21\u578b\uff0c\u5e76\u7f16\u5199\u4e24\u4e2a\u89c6\u56fe(\u5bf9\u5e94\u4e24\u4e2aURLs)\uff0c\u4e00\u4e2a\u7528\u4e8e\u6dfb\u52a0\u9875\u9762\uff0c\u4e00\u4e2a\u7528\u4e8e\u5c55\u793a\u9875\u9762\u8be6\u60c5\u3002staticpage\u76ee\u5f55\u4e0b\u6211\u4eec\u5c06\u8981\u7f16\u8f91\u6216\u521b\u5efa5\u4e2a.py\u6587\u4ef6\uff0c\u5206\u522b\u662fmodels.py, urls.py, views.py, forms.py\u548ctasks.py\uff0c\u5176\u4e2d\u524d4\u4e2a\u90fd\u662f\u6807\u51c6\u7684Django\u9879\u76ee\u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\u6240\u793a\u3002\u6700\u540e\u4e00\u4e2atasks.py\u7528\u4e8e\u5b58\u653e\u6211\u4eec\u81ea\u5df1\u7f16\u5199\u7684\u5f02\u6b65\u4efb\u52a1\uff0c\u7a0d\u540e\u6211\u4f1a\u8be6\u7ec6\u8bb2\u89e3\u3002<\/span><\/p>\n<pre lang=\"python\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># staticpage\/models.py<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from django.db import models<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">import os<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from django.conf import settings<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">class Page(models.Model):<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0title = models.CharField(max_length=100, verbose_name=\"\u6807\u9898\")<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0body = models.TextField(verbose_name=\"\u6b63\u6587\")<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0def __int__(self):<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0return self.title<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0# \u9759\u6001\u6587\u4ef6URL\u5730\u5740\uff0c\u6bd4\u5982\/media\/html\/page_8.html<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0def get_static_page_url(self):<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0return os.path.join(settings.MEDIA_URL, 'html', 'page_{}.html'.format(self.id))<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># staticpage\/urls.py<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from django.urls import path, re_path<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from . import views<\/span><br \/>\u00a0<br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">urlpatterns = [<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0# Create a page \u521b\u5efa\u9875\u9762<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0path('', views.page_create, name='page_create'),<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0# Page detail \u5c55\u793a\u9875\u9762\u8be6\u60c5\u3002\u52a8\u6001URL\u5730\u5740\u4e3a\/page\/8\/<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0re_path(r'^page\/(?P&lt;pk&gt;d+)\/<\/span><\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u4ece<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">page_create<\/code>\u89c6\u56fe\u51fd\u6570\u4e2d\u4f60\u53ef\u4ee5\u770b\u5230\u6211\u4eec\u5728\u4e00\u4e2apage\u5b9e\u4f8b\u5b58\u5230\u6570\u636e\u5e93\u540e\u8c03\u7528\u4e86<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">generate_static_page<\/code>\u51fd\u6570\u5728\u540e\u53f0\u5b8c\u6210\u9759\u6001HTML\u9875\u9762\u7684\u751f\u6210\u3002\u5982\u679c\u6211\u4eec\u4e0d\u4f7f\u7528\u5f02\u6b65\u7684\u5316\uff0c\u6211\u4eec\u8981\u7b49\u9759\u6001HTML\u6587\u4ef6\u5b8c\u5168\u751f\u6210\u540e\u624d\u80fd\u8df3\u8f6c\u5230\u9875\u9762\u8be6\u60c5\u9875\u9762, \u8fd9\u6709\u53ef\u80fd\u8981\u7b49\u597d\u51e0\u79d2\u3002<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">generate_static_page<\/code>\u5c31\u662f\u6211\u4eec\u81ea\u5b9a\u4e49\u7684\u5f02\u6b65\u4efb\u52a1\uff0c\u4ee3\u7801\u5982\u4e0b\u6240\u793a\u3002Celery\u53ef\u4ee5\u81ea\u52a8\u53d1\u73b0\u6bcf\u4e2aDjango app\u4e0b\u7684\u5f02\u6b65\u4efb\u52a1\uff0c\u4e0d\u7528\u62c5\u5fc3\u3002<\/span><\/p>\n<pre lang=\"python\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># staticpage\/tasks.py<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">import os, time<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from django.template.loader import render_to_string<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from django.conf import settings<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from celery import shared_task<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">@shared_task<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">def generate_static_page(page_id, page_title, page_body):<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0# \u6a21\u62df\u8017\u65f6\u4efb\u52a1\uff0c\u6bd4\u5982\u5199\u5165\u6587\u4ef6\u6216\u53d1\u9001\u90ae\u4ef6\u7b49\u64cd\u4f5c\u3002<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0time.sleep(5)<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0# \u83b7\u53d6\u4f20\u9012\u7684\u53c2\u6570<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0page = {'title': page_title, 'body': page_body}<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0context = {'page': page, }<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0# \u6e32\u67d3\u6a21\u677f\uff0c\u751f\u6210\u5b57\u7b26\u4e32<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0content = render_to_string('staticpage\/template.html', context)<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0# \u5b9a\u4e49\u751f\u6210\u9759\u6001\u6587\u4ef6\u6240\u5c5e\u76ee\u5f55\uff0c\u4f4d\u4e8emedia\u6587\u4ef6\u5939\u4e0b\u540d\u4e3ahtml\u7684\u5b50\u6587\u4ef6\u5939\u91cc\u3002\u5982\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c\u5219\u521b\u5efa\u3002<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0directory = os.path.join(settings.MEDIA_ROOT, \"html\")<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0if not os.path.exists(directory):<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0os.makedirs(directory)<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0# \u62fc\u63a5\u76ee\u6807\u5199\u5165\u6587\u4ef6\u5730\u5740<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0static_html_path = os.path.join(directory, 'page_{}.html'.format(page_id))<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0# \u5c06\u6e32\u67d3\u8fc7\u7684\u5b57\u7b26\u4e32\u5199\u5165\u76ee\u6807\u6587\u4ef6<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0with open(static_html_path, 'w', encoding=\"utf-8\") as f:<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0f.write(content)<\/span><br \/>\u00a0<\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u672c\u4f8b\u4e2d\u6211\u4eec\u751f\u6210\u7684\u9759\u6001HTML\u6587\u4ef6\u4f4d\u4e8emedia\u6587\u4ef6\u5939\u4e0b\u7684html\u5b50\u6587\u4ef6\u5939\u91cc\uff0c\u8fd9\u6837\u505a\u6709\u4e24\u4e2a\u597d\u5904\uff1a<\/span><\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-left: 30px; width: 577.188px; white-space: normal; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\">\n<li style=\"font-size: 14px;\">\n<p style=\"margin-bottom: 0.5rem; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem;\">\u4e0eDjango\u7684\u9759\u6001\u6587\u4ef6\u5b58\u50a8\u89c4\u8303\u4fdd\u6301\u4e00\u81f4\uff1a\u7528\u6237\u4ea7\u751f\u7684\u9759\u6001\u6587\u4ef6\u90fd\u653e\u5728media\u6587\u4ef6\u4e0b\uff0c\u7f51\u7ad9\u672c\u8eab\u6240\u4f9d\u8d56\u7684\u9759\u6001\u6587\u4ef6\u90fd\u653e\u4e8estatic\u6587\u4ef6\u5939\u4e0b\u3002<\/p>\n<\/li>\n<li style=\"font-size: 14px;\">\n<p style=\"margin-bottom: 0.5rem; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem;\">\u628a\u6240\u6709\u4ea7\u751f\u7684\u9759\u6001\u6587\u4ef6\u653e\u5728\u4e00\u4e2a\u76ee\u5f55\u91cc\u4e0e\u52a8\u6001\u6587\u4ef6\u76f8\u5206\u5f00\uff0c\u5229\u4e8e\u540e\u7eed\u901a\u8fc7nginx\u90e8\u7f72\u3002<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u672c\u9879\u76ee\u4e2d\u8fd8\u7528\u5230\u4e863\u4e2a\u6a21\u677f\uff0c\u5206\u522b\u662fbase.html, detail.html\u548ctemplate.html\u3002base.html\u548cdetail.html\u662f\u6ca1\u6709\u4efb\u4f55\u6837\u5f0f\u7684, \u4ec5\u7528\u4e8e\u52a8\u6001\u663e\u793a\u5185\u5bb9\uff0ctemplate.html\u662f\u7528\u6765\u751f\u6210\u9759\u6001\u6587\u4ef6\u7684\u6a21\u677f\uff0c\u662f\u5e26\u6837\u5f0f\u7684\uff0c\u8fd9\u6837\u4f60\u5c31\u53ef\u4ee5\u5f88\u5feb\u533a\u5206\u52a8\u6001\u9875\u9762\u548c\u9759\u6001\u9875\u9762\u3002\u7531\u4e8e\u6211\u4eec\u540e\u53f0\u751f\u6210\u9759\u6001\u6587\u4ef6\u81f3\u5c11\u9700\u89815\u79d2\u949f\uff0c\u6211\u4eec\u5728detail.html\u7528\u4e86\u70b9javascript\u5b9e\u73b0\u7b495\u79d2\u5012\u8ba1\u65f6\u5b8c\u6210\u540e\u663e\u793a\u751f\u6210\u7684\u9759\u6001HTML\u6587\u4ef6\u5730\u5740\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">3\u4e2a\u6a21\u677f\u5747\u4f4d\u4e8e<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">staticpage\/templates\/staticpage\/<\/code>\u6587\u4ef6\u5939\u4e0b\uff0c\u4ee3\u7801\u5982\u4e0b\u6240\u793a\uff1a<\/span><\/p>\n<pre lang=\"html\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># base.html<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;!DOCTYPE html&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;html lang=\"en\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;head&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0&lt;meta charset=\"UTF-8\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0&lt;title&gt;\u6dfb\u52a0\u9875\u9762&lt;\/title&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;\/head&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;body&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 &lt;h2&gt;\u6dfb\u52a0\u9875\u9762&lt;\/h2&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 &lt;form name=\"myform\" \u00a0method=\"POST\" action=\".\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 {% csrf_token %}<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 {{ form.as_p }}<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 &lt;button type=\"submit\"&gt;Submit&lt;\/button&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 &lt;\/form&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;\/body&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;\/html&gt;<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># detail.html<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;!DOCTYPE html&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;html lang=\"en\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;head&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0&lt;meta charset=\"UTF-8\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0&lt;title&gt;{{ page.title }}&lt;\/title&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;\/head&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;body&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 &lt;h2&gt;{{ page.title }}&lt;\/h2&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 &lt;p&gt;{{ page.body }}&lt;\/p&gt;<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 &lt;p&gt;\u5012\u8ba1\u65f6: &lt;span id=\"Time\"&gt;5&lt;\/span&gt;&lt;\/p&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 &lt;p id=\"static_url\" style=\"display:none;\"&gt; &lt;small&gt;&lt;a href='{{ page.get_static_page_url }}'&gt;\u8df3\u8f6c\u5230\u9759\u6001\u6587\u4ef6&lt;\/a&gt;&lt;\/small&gt;&lt;\/p&gt;<\/span><br \/>\u00a0<br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;script&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\/\/\u4f7f\u7528\u533f\u540d\u51fd\u6570\u65b9\u6cd5<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0function countDown(){<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0var time = document.getElementById(\"Time\");<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0var p = document.getElementById(\"static_url\");<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\/\/\u83b7\u53d6\u5230id\u4e3atime\u6807\u7b7e\u4e2d\u7684\u5185\u5bb9\uff0c\u73b0\u8fdb\u884c\u5224\u65ad<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0if(time.innerHTML == 0){<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\/\/\u7b49\u4e8e0\u65f6, \u663e\u793a\u9759\u6001HTML\u6587\u4ef6URL<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0p.style.display = \"block\";<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0}else{<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0time.innerHTML = time.innerHTML-1;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0}<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0}<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\/\/1000\u6beb\u79d2\u8c03\u7528\u4e00\u6b21<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0window.setInterval(\"countDown()\",1000);<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0&lt;\/script&gt;<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;\/body&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;\/html&gt;<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># template.html \u751f\u6210\u9759\u6001\u6587\u4ef6\u6a21\u677f<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">{% load static %}<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;html lang=\"en\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;head&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;title&gt;{% block title %}Django\u6587\u6863\u7ba1\u7406{% endblock %} &lt;\/title&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;meta charset=\"utf-8\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.5\/css\/bootstrap.min.css\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;\/head&gt;<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;body&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;nav class=\"navbar navbar-inverse navbar-static-top bs-docs-nav\"&gt;<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0&lt;div class=\"container\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0&lt;div class=\"navbar-header\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0&lt;button type=\"button\" class=\"navbar-toggle\"  &gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;span class=\"icon-bar\"&gt;&lt;\/span&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;span class=\"icon-bar\"&gt;&lt;\/span&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;span class=\"icon-bar\"&gt;&lt;\/span&gt; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0&lt;\/button&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0&lt;a class=\"navbar-brand\" href=\"#\"&gt;&lt;strong&gt;Django + Celery + Redis\u5f02\u6b65\u751f\u6210\u9759\u6001\u6587\u4ef6&lt;\/strong&gt;&lt;\/a&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 &lt;\/div&gt;<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0&lt;div class=\"collapse navbar-collapse\" id=\"myNavbar\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 &lt;ul class=\"nav navbar-nav navbar-right\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0{% if request.user.is_authenticated %}<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;li class=\"dropdown\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;a class=\"dropdown-toggle btn-green\"  href=\"#\"&gt;&lt;span class=\"glyphicon glyphicon-user\"&gt;&lt;\/span&gt; {{ request.user.username }} &lt;span class=\"caret\"&gt;&lt;\/span&gt;&lt;\/a&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;ul class=\"dropdown-menu\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;li&gt;&lt;a \u00a0href=\"#\"&gt;My Account&lt;\/a&gt;&lt;\/li&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;li&gt;&lt;a \u00a0href=\"#\"&gt;Logout&lt;\/a&gt;&lt;\/li&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;\/ul&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;\/li&gt; \u00a0<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 {% else %} \u00a0<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;li class=\"dropdown\"&gt;&lt;a class=\"dropdown-toggle btn-green\" href=\"#\"&gt;&lt;span class=\"glyphicon glyphicon-user\"&gt;&lt;\/span&gt; Sign Up&lt;\/a&gt;&lt;\/li&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;li class=\"dropdown\"&gt;&lt;a class=\"dropdown-toggle\" href=\"#\" &gt;&lt;span class=\"glyphicon glyphicon-log-in\"&gt;&lt;\/span&gt; Login&lt;\/a&gt;&lt;\/li&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0{% endif %}<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 &lt;\/ul&gt;<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0&lt;\/div&gt;<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0&lt;\/div&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;\/nav&gt; \u00a0 \u00a0<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0&lt;!-- Page content of course! --&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;main id=\"section1\" class=\"container-fluid\"&gt;<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;div class=\"container\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0&lt;div class=\"row\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 &lt;div class=\"col-sm-3 col-hide\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 &lt;ul&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;li&gt; &lt;a href=\"{% url 'page_create' %}\"&gt;\u6dfb\u52a0\u9875\u9762&lt;\/a&gt; &lt;\/li&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 &lt;\/ul&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 &lt;\/div&gt;<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 &lt;div class=\"col-sm-9\"&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;h3&gt;{{ page.title }}&lt;\/h3&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 {{ page.body }}<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 &lt;\/div&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;\/div&gt;<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;\/div&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;\/main&gt;<\/span><br \/><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;script src=\"https:\/\/code.jquery.com\/jquery-3.3.1.min.js\" integrity=\"sha256-FgpCb\/KJQlLNfOu91ta32o\/NMZxltwRo8QtmkMRdAu8=\" crossorigin=\"anonymous\"&gt;&lt;\/script&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;\/body&gt;<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">&lt;\/html&gt;<\/span><\/pre>\n<h3 style=\"margin-top: 20px; margin-bottom: 7px; font-weight: bold; font-size: 1.4rem; break-after: avoid-page; break-inside: avoid; line-height: 1.43; cursor: text; white-space: pre-wrap; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; text-align: start;\"><span style=\"font-size: 14px;\">\u7b2c\u516d\u6b65\uff1a\u5728Django\u4e2d\u6ce8\u518capp\u5e76\u6dfb\u52a0app\u7684URLConf<\/span><\/h3>\n<pre lang=\"python\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u4fee\u6539myproject\/settings.py\uff0c\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">INSTALLED_APPS = [<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0'django.contrib.admin',<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0'django.contrib.auth',<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0'django.contrib.contenttypes',<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0'django.contrib.sessions',<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0'django.contrib.messages',<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0'django.contrib.staticfiles',<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0'staticpage',<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">]<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u8bbe\u7f6eSTATIC_URL\u548cSTATIC_ROOT<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">STATIC_URL = '\/static\/'<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">STATIC_ROOT = os.path.join(BASE_DIR, 'static')<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u8bbe\u7f6eMEDIA_ROOT\u548cMEDIA_URL<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">MEDIA_ROOT = os.path.join(BASE_DIR, 'media')<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">MEDIA_URL = '\/media\/'<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u4fee\u6539myproject\/urls.py\uff0c\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from django.contrib import admin<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from django.urls import path, include<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from django.conf import settings<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from django.conf.urls.static import static<\/span><br \/>\u00a0<br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">urlpatterns = [<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0path('admin\/', admin.site.urls),<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0path('', include(\"staticpage.urls\")),<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">]<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># Django\u81ea\u5e26\u670d\u52a1\u5668\u9ed8\u8ba4\u4e0d\u652f\u6301\u9759\u6001\u6587\u4ef6\uff0c\u9700\u52a0\u5165\u8fd9\u4e24\u884c\u3002<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">if settings.DEBUG:<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0urlpatterns = urlpatterns + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0urlpatterns = urlpatterns + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)<\/span><\/pre>\n<h3 style=\"margin-top: 20px; margin-bottom: 7px; font-weight: bold; font-size: 1.4rem; break-after: avoid-page; break-inside: avoid; line-height: 1.43; cursor: text; white-space: pre-wrap; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; text-align: start;\"><span style=\"font-size: 14px;\">\u7b2c\u4e03\u6b65\uff1a\u542f\u52a8Django\u670d\u52a1\u5668\u548c\u5e76\u5b89\u88c5Celery\u5f02\u6b65\u4efb\u52a1\u76d1\u63a7\u5de5\u5177<\/span><\/h3>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u5982\u679c\u4e00\u5207\u987a\u5229\uff0c\u8fde\u7eed\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4, \u5373\u53ef\u542f\u52a8Django\u6d4b\u8bd5\u670d\u52a1\u5668\u3002\u6253\u5f00<span style=\"word-break: break-all;\" spellcheck=\"false\">http:\/\/127.0.0.1:8000\/<\/span>\u5373\u53ef\u770b\u5230\u6211\u4eec\u9879\u76ee\u5f00\u5934\u7684\u52a8\u753b\u5566\u3002\u6ce8\u610f\uff1a\u8bf7\u786e\u4fddredis\u548ccelery\u5df2\u540c\u65f6\u5f00\u542f\u3002<\/span><\/p>\n<pre lang=\"bash\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">python manage.py makemigrations<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">python manage.py migrate<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">python manage.py runserver<\/span><\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u5982\u679c\u4f60\u8981\u76d1\u63a7\u5f02\u6b65\u4efb\u52a1\u7684\u8fd0\u884c\u72b6\u6001\uff08\u6bd4\u5982\u662f\u5426\u6210\u529f\uff0c\u662f\u5426\u6709\u8fd4\u56de\u7ed3\u679c), \u8fd8\u53ef\u4ee5\u5b89\u88c5flower\u8fd9\u4e2aCelery\u76d1\u63a7\u5de5\u5177\u3002<\/span><\/p>\n<pre lang=\"python\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">pip install flower<\/span><\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u5b89\u88c5\u597d\u540e\uff0c\u4f60\u6709\u5982\u4e0b\u4e24\u79cd\u65b9\u5f0f\u542f\u52a8\u670d\u52a1\u5668\u3002\u542f\u52a8\u670d\u52a1\u5668\u540e\uff0c\u6253\u5f00http:\/\/localhost:5555\u5373\u53ef\u67e5\u770b\u76d1\u63a7\u60c5\u51b5\u3002<\/span><\/p>\n<pre lang=\"bash\" style=\"overflow-wrap: normal; overflow: visible; font-family: var(--font-monospace); font-size: 0.85rem; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; width: inherit; -webkit-font-smoothing: initial; line-height: 1.43rem; border-radius: 2px; color: #34495e; margin-top: 0.8rem !important; margin-bottom: 0.8rem !important; padding-top: 0.3rem !important; padding-bottom: 0.3rem !important; background-color: #f8f8f8 !important; border: 1px solid #f4f4f4;\" spellcheck=\"false\">\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u4eceterminal\u7ec8\u7aef\u542f\u52a8, proj\u4e3a\u9879\u76ee\u540d<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">$ flower -A proj --port=5555 \u00a0<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># \u4ececelery\u542f\u52a8<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">$ celery flower -A proj --address=127.0.0.1 --port=5555<\/span><\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\">\u00a0<\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u76d1\u63a7\u5f02\u6b65\u4efb\u52a1\u8fd8\u662f\u5f88\u91cd\u8981\u7684\uff0c\u5f3a\u70c8\u5efa\u8bae\u5b89\u88c5flower\u3002\u6bd4\u5982\u4e0b\u56fe\u4e2d\u6709\u4e9b\u4efb\u52a1\u5c31\u5931\u8d25\u4e86\u3002<\/span><\/p>\n<p style=\"white-space: normal; text-align: center;\"><img decoding=\"async\" class=\"rich_pages\" title=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/05\/7-1621262734-1.png\" alt=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" \/><\/p>\n<h3 style=\"margin-top: 20px; margin-bottom: 7px; font-weight: bold; font-size: 1.4rem; break-after: avoid-page; break-inside: avoid; line-height: 1.43; cursor: text; white-space: pre-wrap; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; text-align: start;\"><span style=\"font-size: 14px;\">\u6e90\u7801\u5730\u5740<\/span><\/h3>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"word-break: break-all; font-size: 14px;\">https:\/\/github.com\/shiyunbo\/django-static-page-generator-celery-redis<\/span><\/p>\n<section style=\"white-space: normal; font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; color: #3e3e3e; line-height: 1.8; word-spacing: 1.6px; letter-spacing: 0.5px;\">\n<section style=\"margin-right: 9px; margin-bottom: 5px; margin-left: 9px; font-size: inherit; min-height: 1em; color: inherit; line-height: 1.75em; text-align: center;\"><img decoding=\"async\" style=\"letter-spacing: 0.544px; word-spacing: 1.6px; background-color: #ffffff; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 16px; font-variant-numeric: normal; line-height: 25.6px; widows: 1; display: inline; box-sizing: border-box !important; visibility: visible !important; width: auto !important;\" title=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/05\/0-1621262734.gif\" alt=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" \/><\/section>\n<section style=\"font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.51px; background-color: #ffffff;\">\n<section style=\"display: flex; justify-content: center; align-items: center; width: 677px;\">\n<section style=\"display: flex; justify-content: flex-start; align-items: center; flex-direction: column;\">\n<section style=\"margin-bottom: -37px; margin-left: -21px; width: 21px; height: 38px; display: flex; justify-content: center; align-items: center; align-self: flex-start; z-index: 1;\"><img decoding=\"async\" style=\"box-sizing: border-box !important; visibility: visible !important; width: 21px !important;\" src=\"https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/lpHDr05YrIRQgT2sib9SWGE99gWsPW7x8FP6LoMYvgkmO9jSQjFqfcMVBUsiaSKickqickc7k2Kwah52tbzMnA316k2WA88rXLAX\/640?wx_fmt=svg\" \/><\/section>\n<section style=\"margin-right: -27px; margin-bottom: -39px; width: 27px; height: 38px; display: flex; justify-content: center; align-items: center; align-self: flex-end; z-index: 1;\"><img decoding=\"async\" style=\"box-sizing: border-box !important; visibility: visible !important; width: 27px !important;\" src=\"https:\/\/mmbiz.qpic.cn\/mmbiz_svg\/ibKHP1TZZeXLuZkD53jFWzc8iauhHlerlWDib9Dgm1JiaSF9LB4RGxxD4cSFrUoIeI4fvic7VPGpKGv8AqCJgcUeqLoOAXBW6kKov\/640?wx_fmt=svg\" \/><\/section>\n<section style=\"padding: 9px 19px 8px 20px; text-align: center; background: #f98b9a;\">\n<p style=\"font-size: 16px; font-family: PingFangSC-Semibold, 'PingFang SC'; font-weight: bold; color: #ffffff; line-height: 22px; letter-spacing: 1px;\">\u9001\u4e66\u6d3b\u52a8<\/p>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<p style=\"font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.51px; background-color: #ffffff; text-align: center;\"><img decoding=\"async\" class=\"rich_pages\" style=\"width: 260px; box-shadow: none; font-size: 17px; box-sizing: border-box !important; visibility: visible !important;\" title=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/05\/4-1621262734.jpeg\" alt=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" \/><\/p>\n<p style=\"font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.51px; background-color: #ffffff;\">\u00a0<\/p>\n<p style=\"font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.51px; background-color: #ffffff;\"><span style=\"color: #666666; font-family: \u5fae\u8f6f\u96c5\u9ed1; text-align: left; text-indent: 59px; font-size: 16px;\">\u672c\u4e66\u517113\u7ae0\uff0c\u4e3b\u8981\u5185\u5bb9\u6db5\u76d6Python\u8bed\u6cd5\u53ca\u6570\u636e\u5206\u6790\u65b9\u6cd5\u3002\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u6570\u636e\u5206\u6790\u7684\u6982\u5ff5\uff0c\u4f7f\u8bfb\u8005\u6709\u4e00\u4e2a\u5927\u81f4\u7684\u5370\u8c61\uff0c\u5e76\u7b80\u5355\u4ecb\u7ecd\u672c\u4e66\u9891\u7e41\u4f7f\u7528\u7684Python\u76845\u4e2a\u7b2c\u4e09\u65b9\u5e93\u3002\u7b2c2\u7ae0\u4e3b\u8981\u505a\u4e00\u4e9b\u51c6\u5907\u5de5\u4f5c\uff0c\u624b\u628a\u624b\u5e26\u8bfb\u8005\u642d\u5efaPython\u73af\u5883\uff0c\u5305\u62ecPython 3.7.6\u7684\u5b89\u88c5\u548cpip\u7684\u5b89\u88c5\u3002\u7b2c3\u7ae0\u4ecb\u7ecdPython\u7f16\u7a0b\u57fa\u7840\u3002\u7b2c4\u7ae0\u5230\u7b2c7\u7ae0\u4ecb\u7ecd\u4f7f\u7528Python\u8fdb\u884c\u7b80\u5355\u6570\u636e\u5206\u6790\u7684\u57fa\u7840\u5e93\uff0c\u5305\u62ec<\/span><span style=\"font-family: \u5fae\u8f6f\u96c5\u9ed1; text-align: left; text-indent: 59px; font-size: 16px; color: #5572ea;\">NumPy\u3001Pandas\u548cMatplotlib<\/span><span style=\"color: #666666; font-family: \u5fae\u8f6f\u96c5\u9ed1; text-align: left; text-indent: 59px; font-size: 16px;\">\u5e93\uff0c\u5e76\u4ecb\u7ecd\u4f7f\u7528<\/span><span style=\"font-family: \u5fae\u8f6f\u96c5\u9ed1; text-align: left; text-indent: 59px; font-size: 16px; color: #5572ea;\">\u6b63\u5219\u8868\u8fbe\u5f0f\u5904\u7406\u6570\u636e<\/span><span style=\"color: #666666; font-family: \u5fae\u8f6f\u96c5\u9ed1; text-align: left; text-indent: 59px; font-size: 16px;\">\u7684\u65b9\u6cd5\u3002\u7b2c8\u7ae0\u52303\u7ae0\u5c5e\u4e8e\u8fdb\u9636\u5185\u5bb9\uff0c\u4f46\u4e5f\u662fPython\u6570\u636e\u5206\u6790\u7684\u57fa\u7840\uff0c\u7ed3\u5408\u673a\u5668\u5b66\u4e60\u4ecb\u7ecd\u4e00\u4e9b<\/span><span style=\"font-family: \u5fae\u8f6f\u96c5\u9ed1; text-align: left; text-indent: 59px; font-size: 16px; color: #5572ea;\">\u5e38\u89c1\u7684\u7528\u4e8e\u6570\u636e\u5206\u6790\u7684\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u53ca\u5e38\u7528\u7684\u6570\u5b66\u6a21\u578b\u3002<\/span><\/p>\n<section><\/section>\n<p style=\"font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.51px; background-color: #ffffff; text-align: center;\"><span style=\"font-size: 17px;\"><strong><span style=\"color: #ff4c00;\">\u8d60\u4e66\u89c4\u5219<\/span><\/strong><\/span><\/p>\n<p style=\"margin-top: 10px; margin-right: 8px; margin-left: 8px; font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; white-space: normal;\"><strong style=\"font-size: 14px;\"><span style=\"text-align: start; letter-spacing: 0.5px; text-indent: 0em; font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; color: #ff4c00;\">\u8d60\u4e66\u672c\u6570<\/span><\/strong><span style=\"text-indent: 0em; letter-spacing: 0.544px; color: #4d4d4d; font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif, SimHei, SimSun; text-align: start;\"><span style=\"font-size: 14px;\">\uff1a<\/span><span style=\"font-size: 14px;\">\u672c\u6b21\u5171\u5305\u90ae\u9001\u4e66\u00a0<\/span><\/span><span style=\"font-size: 14px; letter-spacing: 0.5px; text-indent: 0em; font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;\"><strong style=\"font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px;\"><span style=\"letter-spacing: 0.5px; text-indent: 0em; font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; color: #ff0000;\">3\u00a0<\/span><\/strong><\/span><span style=\"font-size: 14px; letter-spacing: 0.5px; text-indent: 0em; font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;\"><strong style=\"font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px;\"><span style=\"letter-spacing: 0.5px; text-indent: 0em; font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; color: #ff0000;\">\u672c<\/span><\/strong><\/span><\/p>\n<section style=\"margin-right: 8px; margin-left: 8px; font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; white-space: normal; min-height: 1em;\"><span style=\"font-size: 14px;\"><strong><span style=\"text-align: start; letter-spacing: 0.5px; text-indent: 0em; font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; color: #ff4c00;\">\u53c2\u4e0e\u65b9\u5f0f<\/span><\/strong><span style=\"text-indent: 0em; letter-spacing: 0.544px; color: #4d4d4d; font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif, SimHei, SimSun; text-align: start;\">\uff1a\u5728<strong>Python\u732b<\/strong>\u8bfb\u8005\u7fa4\u62bd\u5956\uff0c<strong>\u4ec5\u9650\u7fa4\u53cb<\/strong>\u53c2\u4e0e\u3002\u540e\u53f0\u53d1\u201c<\/span><\/span><span style=\"text-indent: 0em; letter-spacing: 0.544px; font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif, SimHei, SimSun; text-align: start; font-size: 14px; color: #ff4c00;\">\u4ea4\u6d41\u7fa4<\/span><span style=\"font-size: 14px; text-indent: 0em; letter-spacing: 0.544px; color: #4d4d4d; font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif, SimHei, SimSun; text-align: start;\">\u201d\uff0c\u83b7\u53d6\u5165\u7fa4\u65b9\u5f0f\u3002<\/span><\/section>\n<section style=\"margin-right: 8px; margin-left: 8px; font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; white-space: normal; min-height: 1em;\"><span style=\"font-size: 14px;\"><strong><span style=\"letter-spacing: 0.5px; text-indent: 0em; font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; color: #ff4c00;\">\u5f00\u5956\u65f6\u95f4<\/span><\/strong><span style=\"letter-spacing: 0.5px; text-indent: 0em; font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;\">\uff1a2021\u5e745\u670820\u65e518:00<\/span><\/span><\/section>\n<\/section>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<\/div>\n<p>, views.page_detail, name=&#8217;page_detail&#8217;),<br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 ]<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># staticpage\/views.py<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from django.shortcuts import render, redirect, get_object_or_404<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from django.urls import reverse<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from .forms import PageForm<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from .models import Page<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from .tasks import generate_static_page<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">def page_create(request):<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0if request.method == &#8216;POST&#8217;:<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0form = PageForm(request.POST)<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0if form.is_valid():<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0page = form.save()<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0generate_static_page.delay(page.id, page.title, page.body)<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0return redirect(reverse(&#8216;page_detail&#8217;, args=[str(page.pk)]))<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0else:<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0form = PageForm()<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0return render(request, &#8216;staticpage\/base.html&#8217;, {&#8216;form&#8217;: form})<\/span><br \/>\u00a0<br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">def page_detail(request, pk):<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0page = get_object_or_404(Page, id=pk)<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0return render(request, &#8216;staticpage\/detail.html&#8217;, {&#8216;page&#8217;: page})<\/span><br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\"># staticpage\/forms.py<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from django import forms<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">from .models import Page<\/span><br \/>\u00a0<br \/>\u00a0<br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">class PageForm(forms.ModelForm):<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0class Meta:<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0model = Page<\/span><br \/>\u00a0<span style=\"padding-right: 0.1px;\" role=\"presentation\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0exclude = ()<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u4ece<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">page_create<\/code>\u89c6\u56fe\u51fd\u6570\u4e2d\u4f60\u53ef\u4ee5\u770b\u5230\u6211\u4eec\u5728\u4e00\u4e2apage\u5b9e\u4f8b\u5b58\u5230\u6570\u636e\u5e93\u540e\u8c03\u7528\u4e86<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">generate_static_page<\/code>\u51fd\u6570\u5728\u540e\u53f0\u5b8c\u6210\u9759\u6001HTML\u9875\u9762\u7684\u751f\u6210\u3002\u5982\u679c\u6211\u4eec\u4e0d\u4f7f\u7528\u5f02\u6b65\u7684\u5316\uff0c\u6211\u4eec\u8981\u7b49\u9759\u6001HTML\u6587\u4ef6\u5b8c\u5168\u751f\u6210\u540e\u624d\u80fd\u8df3\u8f6c\u5230\u9875\u9762\u8be6\u60c5\u9875\u9762, \u8fd9\u6709\u53ef\u80fd\u8981\u7b49\u597d\u51e0\u79d2\u3002<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">generate_static_page<\/code>\u5c31\u662f\u6211\u4eec\u81ea\u5b9a\u4e49\u7684\u5f02\u6b65\u4efb\u52a1\uff0c\u4ee3\u7801\u5982\u4e0b\u6240\u793a\u3002Celery\u53ef\u4ee5\u81ea\u52a8\u53d1\u73b0\u6bcf\u4e2aDjango app\u4e0b\u7684\u5f02\u6b65\u4efb\u52a1\uff0c\u4e0d\u7528\u62c5\u5fc3\u3002<\/span><\/p>\n<pre>\u00a0<\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u672c\u4f8b\u4e2d\u6211\u4eec\u751f\u6210\u7684\u9759\u6001HTML\u6587\u4ef6\u4f4d\u4e8emedia\u6587\u4ef6\u5939\u4e0b\u7684html\u5b50\u6587\u4ef6\u5939\u91cc\uff0c\u8fd9\u6837\u505a\u6709\u4e24\u4e2a\u597d\u5904\uff1a<\/span><\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 0.8em; margin-bottom: 0.8em; padding-left: 30px; width: 577.188px; white-space: normal; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\">\n<li style=\"font-size: 14px;\">\n<p style=\"margin-bottom: 0.5rem; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem;\">\u4e0eDjango\u7684\u9759\u6001\u6587\u4ef6\u5b58\u50a8\u89c4\u8303\u4fdd\u6301\u4e00\u81f4\uff1a\u7528\u6237\u4ea7\u751f\u7684\u9759\u6001\u6587\u4ef6\u90fd\u653e\u5728media\u6587\u4ef6\u4e0b\uff0c\u7f51\u7ad9\u672c\u8eab\u6240\u4f9d\u8d56\u7684\u9759\u6001\u6587\u4ef6\u90fd\u653e\u4e8estatic\u6587\u4ef6\u5939\u4e0b\u3002<\/p>\n<\/li>\n<li style=\"font-size: 14px;\">\n<p style=\"margin-bottom: 0.5rem; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem;\">\u628a\u6240\u6709\u4ea7\u751f\u7684\u9759\u6001\u6587\u4ef6\u653e\u5728\u4e00\u4e2a\u76ee\u5f55\u91cc\u4e0e\u52a8\u6001\u6587\u4ef6\u76f8\u5206\u5f00\uff0c\u5229\u4e8e\u540e\u7eed\u901a\u8fc7nginx\u90e8\u7f72\u3002<\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u672c\u9879\u76ee\u4e2d\u8fd8\u7528\u5230\u4e863\u4e2a\u6a21\u677f\uff0c\u5206\u522b\u662fbase.html, detail.html\u548ctemplate.html\u3002base.html\u548cdetail.html\u662f\u6ca1\u6709\u4efb\u4f55\u6837\u5f0f\u7684, \u4ec5\u7528\u4e8e\u52a8\u6001\u663e\u793a\u5185\u5bb9\uff0ctemplate.html\u662f\u7528\u6765\u751f\u6210\u9759\u6001\u6587\u4ef6\u7684\u6a21\u677f\uff0c\u662f\u5e26\u6837\u5f0f\u7684\uff0c\u8fd9\u6837\u4f60\u5c31\u53ef\u4ee5\u5f88\u5feb\u533a\u5206\u52a8\u6001\u9875\u9762\u548c\u9759\u6001\u9875\u9762\u3002\u7531\u4e8e\u6211\u4eec\u540e\u53f0\u751f\u6210\u9759\u6001\u6587\u4ef6\u81f3\u5c11\u9700\u89815\u79d2\u949f\uff0c\u6211\u4eec\u5728detail.html\u7528\u4e86\u70b9javascript\u5b9e\u73b0\u7b495\u79d2\u5012\u8ba1\u65f6\u5b8c\u6210\u540e\u663e\u793a\u751f\u6210\u7684\u9759\u6001HTML\u6587\u4ef6\u5730\u5740\u3002<\/span><\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">3\u4e2a\u6a21\u677f\u5747\u4f4d\u4e8e<code style=\"padding: 2px 4px; font-family: var(--font-monospace); vertical-align: initial; border-radius: 2px; font-size: 0.92rem; color: #e96900; background-color: #f8f8f8;\">staticpage\/templates\/staticpage\/<\/code>\u6587\u4ef6\u5939\u4e0b\uff0c\u4ee3\u7801\u5982\u4e0b\u6240\u793a\uff1a<\/span><\/p>\n<pre>\u00a0<\/pre>\n<h3 style=\"margin-top: 20px; margin-bottom: 7px; font-weight: bold; font-size: 1.4rem; break-after: avoid-page; break-inside: avoid; line-height: 1.43; cursor: text; white-space: pre-wrap; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; text-align: start;\"><span style=\"font-size: 14px;\">\u7b2c\u516d\u6b65\uff1a\u5728Django\u4e2d\u6ce8\u518capp\u5e76\u6dfb\u52a0app\u7684URLConf<\/span><\/h3>\n<pre>\u00a0<\/pre>\n<h3 style=\"margin-top: 20px; margin-bottom: 7px; font-weight: bold; font-size: 1.4rem; break-after: avoid-page; break-inside: avoid; line-height: 1.43; cursor: text; white-space: pre-wrap; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; text-align: start;\"><span style=\"font-size: 14px;\">\u7b2c\u4e03\u6b65\uff1a\u542f\u52a8Django\u670d\u52a1\u5668\u548c\u5e76\u5b89\u88c5Celery\u5f02\u6b65\u4efb\u52a1\u76d1\u63a7\u5de5\u5177<\/span><\/h3>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u5982\u679c\u4e00\u5207\u987a\u5229\uff0c\u8fde\u7eed\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4, \u5373\u53ef\u542f\u52a8Django\u6d4b\u8bd5\u670d\u52a1\u5668\u3002\u6253\u5f00<span style=\"word-break: break-all;\" spellcheck=\"false\">http:\/\/127.0.0.1:8000\/<\/span>\u5373\u53ef\u770b\u5230\u6211\u4eec\u9879\u76ee\u5f00\u5934\u7684\u52a8\u753b\u5566\u3002\u6ce8\u610f\uff1a\u8bf7\u786e\u4fddredis\u548ccelery\u5df2\u540c\u65f6\u5f00\u542f\u3002<\/span><\/p>\n<pre>\u00a0<\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u5982\u679c\u4f60\u8981\u76d1\u63a7\u5f02\u6b65\u4efb\u52a1\u7684\u8fd0\u884c\u72b6\u6001\uff08\u6bd4\u5982\u662f\u5426\u6210\u529f\uff0c\u662f\u5426\u6709\u8fd4\u56de\u7ed3\u679c), \u8fd8\u53ef\u4ee5\u5b89\u88c5flower\u8fd9\u4e2aCelery\u76d1\u63a7\u5de5\u5177\u3002<\/span><\/p>\n<pre>\u00a0<\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u5b89\u88c5\u597d\u540e\uff0c\u4f60\u6709\u5982\u4e0b\u4e24\u79cd\u65b9\u5f0f\u542f\u52a8\u670d\u52a1\u5668\u3002\u542f\u52a8\u670d\u52a1\u5668\u540e\uff0c\u6253\u5f00http:\/\/localhost:5555\u5373\u53ef\u67e5\u770b\u76d1\u63a7\u60c5\u51b5\u3002<\/span><\/p>\n<pre>\u00a0<\/pre>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\">\u00a0<\/p>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"font-size: 14px;\">\u76d1\u63a7\u5f02\u6b65\u4efb\u52a1\u8fd8\u662f\u5f88\u91cd\u8981\u7684\uff0c\u5f3a\u70c8\u5efa\u8bae\u5b89\u88c5flower\u3002\u6bd4\u5982\u4e0b\u56fe\u4e2d\u6709\u4e9b\u4efb\u52a1\u5c31\u5931\u8d25\u4e86\u3002<\/span><\/p>\n<p style=\"white-space: normal; text-align: center;\"><img decoding=\"async\" class=\"rich_pages\" title=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/05\/7-1621262734-1.png\" alt=\"Django 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\" \/><\/p>\n<h3 style=\"margin-top: 20px; margin-bottom: 7px; font-weight: bold; font-size: 1.4rem; break-after: avoid-page; break-inside: avoid; line-height: 1.43; cursor: text; white-space: pre-wrap; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; text-align: start;\"><span style=\"font-size: 14px;\">\u6e90\u7801\u5730\u5740<\/span><\/h3>\n<p style=\"margin-top: 0.8em; margin-bottom: 0.8em; line-height: 1.6rem; orphans: 4; white-space: pre-wrap; word-spacing: 0.05rem; color: #34495e; font-family: Ubuntu, 'Source Sans Pro', sans-serif; font-size: 16px; text-align: start;\"><span style=\"word-break: break-all; font-size: 14px;\">https:\/\/github.com\/shiyunbo\/django-static-page-generator-celery-redis<\/span><\/p>\n<section style=\"white-space: normal; font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; color: #3e3e3e; line-height: 1.8; word-spacing: 1.6px; letter-spacing: 0.5px;\">\n<section style=\"margin-right: 9px; margin-bottom: 5px; margin-left: 9px; font-size: inherit; min-height: 1em; color: inherit; line-height: 1.75em; text-align: center;\"><\/section>\n<\/section>\n\n\n<p>\u8f6c\u81ea\uff1ahttps:\/\/mp.weixin.qq.com\/s\/krlB0WdHpW1GSJhl2SinKw<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005\uff1a\u5927\u6c5f\u72d7 \u6765\u6e90\uff1aPython Web\u4e0eDjango\u5f00\u53d1 \u5927\u5bb6\u597d\uff0c\u6211\u662f\u732b\u54e5\u3002\u4eca\u5929\u5206\u4eab\u4e00\u7bc7\u6587\u7ae0\uff0c\u4f5c\u8005\u5229\u7528Dja &hellip; <a href=\"http:\/\/www.zhushiyao.com\/?p=68869\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cDjango 3.0+Redis 3.4+Celery 4.4 \u5e94\u7528\u5f00\u53d1(\u9644\u6e90\u7801)\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[883,8],"_links":{"self":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/68869"}],"collection":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=68869"}],"version-history":[{"count":2,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/68869\/revisions"}],"predecessor-version":[{"id":68878,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/68869\/revisions\/68878"}],"wp:attachment":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=68869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=68869"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=68869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}