{
  "version": "https://jsonfeed.org/version/1", 
  "title": "Flask", 
  "description": "Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions.", 
  "home_page_url": "https://www.v2ex.com/go/flask", 
  "feed_url": "https://www.v2ex.com/feed/flask.json", 
  "icon": "https://cdn.v2ex.com/navatar/ab81/7c93/467_large.png?m=1646757794", 
  "favicon": "https://cdn.v2ex.com/navatar/ab81/7c93/467_normal.png?m=1646757794", 
  "items": [
    {
      "author": {
        "url": "https://www.v2ex.com/member/nonozone", 
        "name": "nonozone", 
        "avatar": "https://cdn.v2ex.com/avatar/d81f/9c1b/345_large.png?m=1725983291"
      }, 
      "url": "https://www.v2ex.com/t/1071149", 
      "title": "\u8bf7\u6559\u4e00\u4e2a flask \u679a\u4e3e\u6570\u7684\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/1071149", 
      "date_published": "2024-09-08T15:20:53+00:00", 
      "content_html": "<p>\u95ee\u4e86\u534a\u5929 ai \u4e5f\u6ca1\u89e3\u51b3\u3002</p>\n<pre><code>class ApprovalStatus(PyEnum):\n    PENDING = 'pending'\n    APPROVED = 'approved'\n    REJECTED = 'rejected'\n\n\nclass Approval(db.Model):\n    id = db.Column(db.Integer, primary_key=True)\n    content_type = db.Column(db.String(50), nullable=False)\n    content_id = db.Column(db.Integer, nullable=False)\n    field_name = db.Column(db.String(50), nullable=False)\n    new_value = db.Column(db.Text, nullable=False)\n    status = db.Column(db.Enum(ApprovalStatus), default=ApprovalStatus.PENDING)\n    \n\n    submitter_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)\n    submit_time = db.Column(db.DateTime, default=current_time)\n    reviewer_id = db.Column(db.Integer, db.ForeignKey('user.id'))\n    review_time = db.Column(db.DateTime, default=current_time)\n    review_comment = db.Column(db.Text)\n\n    submitter = db.relationship('User', foreign_keys=[submitter_id])\n    reviewer = db.relationship('User', foreign_keys=[reviewer_id])\n\n    __table_args__ = (db.UniqueConstraint('content_type', 'content_id'),)\n\n    @property\n    def content(self):\n        model = getattr(models, self.content_type)\n        return model.query.get(self.content_id)\n</code></pre>\n<p>\u6a21\u578b\u662f\u8fd9\u6837\uff0c\u4f46\u662f\u5728 flask admin \u8bbf\u95ee\u5ba1\u6838\u8fd9\u4e2a\u680f\u76ee\u7684\u65f6\u5019\uff0c\u603b\u662f\u63d0\u793a </p>\n<p>LookupError: 'pending' is not among the defined enum values. Enum name: approvalstatus. Possible values: PENDING, APPROVED, REJECTED</p>\n<p>\u548c\u89e3\u54e6\u3002</p>\n<p>\u7ed3\u679c\u68c0\u67e5\uff0c\u6570\u636e\u5e93\u7684\u72b6\u6001\u680f\u7684\u503c\u90fd\u662f\u5c0f\u5199\u7684\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/guofushan2903", 
        "name": "guofushan2903", 
        "avatar": "https://cdn.v2ex.com/gravatar/a36cbaef7e4312c8062e64c0b1e19589?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1036471", 
      "date_modified": "2024-04-28T11:17:36+00:00", 
      "content_html": "<p>\u5927\u4f6c\u4eec  \uff0cpython  flask \u9879\u76ee\u5982\u4f55\u52a0\u5bc6\u6253\u5305\u90e8\u7f72\uff0c\u6709\u4f55\u601d\u8def</p>\n", 
      "date_published": "2024-04-28T09:22:41+00:00", 
      "title": "Python flask \u9879\u76ee\u5982\u4f55\u52a0\u5bc6\u6253\u5305\u90e8\u7f72", 
      "id": "https://www.v2ex.com/t/1036471"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/turtlekey", 
        "name": "turtlekey", 
        "avatar": "https://cdn.v2ex.com/gravatar/8601f5b0b22ffe8b5a53b21ed9490191?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1018932", 
      "title": "\u8bf7\u6559\u5927\u4f6c\u4eec\u4e00\u4e2a\u5173\u4e8e flask \u7684\u7f13\u5b58\u95ee\u9898\uff1f", 
      "id": "https://www.v2ex.com/t/1018932", 
      "date_published": "2024-02-27T12:45:19+00:00", 
      "content_html": "<p><strong>\u95ee\u9898\u590d\u73b0</strong></p>\n<p>\u6211\u6709\u4e00\u4e2a\u89c6\u56fe\u51fd\u6570\uff0c\u5b83\u7406\u5e94\u5728\u540e\u53f0\u83b7\u53d6\u5f53\u65e5\u7684\u6570\u636e\uff08\u6bcf\u5929\u7684\u6570\u636e\u4e0d\u4e00\u6837\uff09\uff0c\u7136\u540e\u6e32\u67d3\u5230\u524d\u7aef\uff0c\u4f46\u8bbf\u95ee\u5f97\u5230\u7684\u6570\u636e\u5374\u662f\u4e0a\u4e00\u6b21\u8bbf\u95ee\u5f97\u5230\u7684\u6570\u636e\uff08\u5373\u5b83\u4e0d\u4f1a\u81ea\u52a8\u66f4\u65b0\u89c6\u56fe\uff09\uff0c\u5982\u679c\u6211\u63d0\u524d\u5728\u89c6\u56fe\u6e32\u67d3\u51fd\u6570\u524d return \u4e00\u4e2a\u4efb\u610f\u5b57\u7b26\u4e32\uff0c\u5237\u65b0\u8bf7\u6c42\uff0c\u7136\u540e\u6062\u590d\u4ee3\u7801\uff0c\u5b83\u53c8\u6210\u529f\u5730\u66f4\u65b0\u89c6\u56fe\u4e86\u3002</p>\n<p><strong>\u6211\u7684\u731c\u6d4b</strong></p>\n<p>\u4ee3\u7801\u903b\u8f91\u5e94\u8be5\u6ca1\u6709\u95ee\u9898\uff0c\u95ee\u9898\u5927\u6982\u7387\u662f\u5173\u4e8e\u7f13\u5b58\u7684\uff0c\u4e0d\u77e5 flask \u662f\u5426\u6709\u81ea\u52a8\u7f13\u5b58\u673a\u5236\uff0c\u8bf7\u5927\u4f6c\u89e3\u60d1\u3002\u5148\u884c\u611f\u8c22\ud83d\ude4f\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Windyzhou", 
        "name": "Windyzhou", 
        "avatar": "https://cdn.v2ex.com/gravatar/a155051e1cf2fb1b37b108f3a7e7a07f?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1013966", 
      "title": "\u6c42\u5927\u4f6c\u770b\u770b\u6211\u8fd9\u4e2a\u9879\u76ee\uff0c\u4e0d\u4f1a\u751f\u6210\u6570\u636e\u5e93\u6587\u4ef6\u662f\u600e\u4e48\u56de\u4e8b", 
      "id": "https://www.v2ex.com/t/1013966", 
      "date_published": "2024-02-04T00:06:11+00:00", 
      "content_html": "<a target=\"_blank\" href=\"https://github.com/windy003/ppi_made_by_me\" rel=\"nofollow noopener\">https://github.com/windy003/ppi_made_by_me</a>"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/chackchackGO", 
        "name": "chackchackGO", 
        "avatar": "https://cdn.v2ex.com/avatar/1bfa/a60b/455835_large.png?m=1665830450"
      }, 
      "url": "https://www.v2ex.com/t/998973", 
      "date_modified": "2023-12-09T10:11:32+00:00", 
      "content_html": "<p>\u7528 pycharm \u8dd1 flask \u9047\u5230\u5404\u79cd\u7a7a\u683c\u8def\u5f84\u95ee\u9898.<br/>\n\u53ea\u80fd\u7528 vscode \u6765\u8dd1. \u4f46\u662f\u8fd8\u8981\u540c\u65f6\u7528 pycharm \u6765\u770b\u51fd\u6570 usages \u4e4b\u7c7b\u7684\u9ad8\u7ea7 feature....</p>\n", 
      "date_published": "2023-12-09T10:11:23+00:00", 
      "title": "\u5410\u69fd, \u7528 pycharm \u8dd1 flask \u9047\u5230\u5404\u79cd\u7a7a\u683c\u8def\u5f84\u95ee\u9898...", 
      "id": "https://www.v2ex.com/t/998973"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/cypwanfeng", 
        "name": "cypwanfeng", 
        "avatar": "https://cdn.v2ex.com/gravatar/eaa2b0b51c74a36e12420c61c3e2963d?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/994336", 
      "title": "celery \u542f\u52a8\u62a5\u9519", 
      "id": "https://www.v2ex.com/t/994336", 
      "date_published": "2023-11-22T15:27:44+00:00", 
      "content_html": "<p>celery \u94fe\u63a5\u963f\u91cc\u4e91\u96c6\u7fa4\u7248 redis \u62a5\u9519\nredis.exceptions.ResponseError: 'BRPOP' command keys must in same slot\n\u6c42\u5927\u4f6c\u4eec\u5eb7\u5eb7</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/googlehub", 
        "name": "googlehub", 
        "avatar": "https://cdn.v2ex.com/avatar/3eef/c228/453158_large.png?m=1605933849"
      }, 
      "url": "https://www.v2ex.com/t/988138", 
      "title": "\u4f7f\u7528 Flask-SocketIO \u4e0e Android \u7aef\u5b9e\u73b0\u4e00\u5957 IM \u5373\u65f6\u901a\u8baf", 
      "id": "https://www.v2ex.com/t/988138", 
      "date_published": "2023-11-03T02:12:44+00:00", 
      "content_html": "<p>\u5982\u9898\uff0c\u6700\u8fd1\u7528 Flask-SocketIO \u5b9e\u73b0\u4e00\u5957 api \u63a5\u53e3\u5b9e\u73b0\u4e0e android \u7aef\u7684\u903b\u8f91\uff0c\u5b9e\u73b0 android \u7aef\u4e92\u76f8\u901a\u8baf\u5b9e\u73b0\u4e00\u5bf9\u4e00\u804a\u5929\uff0c\u5927\u5bb6\u6709\u63a8\u8350\u5b66\u4e60\u7684\u4ee3\u7801\u6216\u8005 demo \u4e4b\u7c7b\u7684\u5417\uff1f</p>\n<p>\u76ee\u524d\u81ea\u5df1\u5b9e\u73b0\u4e86\u90e8\u5206\uff0c\u4f46\u662f\u6709\u4e9b\u7ec6\u8282\u8fd8\u6709\u4e9b\u7591\u60d1\uff0c\u60f3\u627e\u4e2a\u6848\u4f8b\u6765\u68b3\u7406\u5b66\u4e60\u4e0b\u3002</p>\n<p>\u5927\u4f6c\u4eec \u6c42\u63a8\u8350\u76f8\u5173\u7684\u8d44\u6599\u4e0b\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/QGabriel", 
        "name": "QGabriel", 
        "avatar": "https://cdn.v2ex.com/avatar/c589/c6e8/440144_large.png?m=1646193143"
      }, 
      "url": "https://www.v2ex.com/t/961884", 
      "title": "flask \u81ea\u4ece\u52a0\u4e86 https \u540e\u7a0b\u5e8f\u8fd0\u884c\u4e00\u6bb5\u65f6\u95f4\u5c31\u6ca1\u54cd\u5e94\u4e86.", 
      "id": "https://www.v2ex.com/t/961884", 
      "date_published": "2023-08-02T09:40:52+00:00", 
      "content_html": "windows \u7cfb\u7edf,flask \u63d0\u4f9b\u63a5\u53e3\u7ed9\u5c0f\u7a0b\u5e8f\u7528, \u8bf7\u6c42\u91cf\u4e2d\u5ea6.<br />\u73b0\u5728\u80fd\u6392\u9664\u7684\u662f\u4e0e mongodb \u548c\u7cfb\u7edf\u5185\u5b58\u6ca1\u5173\u7cfb.<br />\u8fd0\u884c\u4e2a 4-6 \u5c0f\u65f6\u8bf7\u6c42\u5c31\u65e0\u54cd\u5e94\u4e86.<br />\u9ebb\u70e6\u5927\u4f6c\u652f\u62db\u6392\u67e5\u4e00\u4e0b\u95ee\u9898~"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Oilybear", 
        "name": "Oilybear", 
        "avatar": "https://cdn.v2ex.com/gravatar/239af51c606a908ae70939c2828f2fb7?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/925899", 
      "title": "\u7ed9\u7b97\u6cd5\u6a21\u578b\u505a\u540e\u7aef\u7684 flask \u5728\u751f\u4ea7\u90e8\u7f72\u65f6\u662f\u5426\u8fd8\u9700\u8981 Gunicorn+ Gevent", 
      "id": "https://www.v2ex.com/t/925899", 
      "date_published": "2023-03-21T08:53:19+00:00", 
      "content_html": "<p>RT,\nflask \u65f6\u4e00\u4e2a\u901a\u5e38\u60c5\u51b5\u4e0b\u662f\u4e00\u4e2a\u5355\u8fdb\u5355\u7ebf\u6846\u67b6\uff0c\u6240\u4ee5\u751f\u4ea7\u4e00\u822c\u4f1a\u8fd8\u4f1a\u5957\u4e00\u5c42 Gunicorn + Gevent \u6765\u6ee1\u8db3\u5e76\u53d1\u9700\u6c42\uff0c\u4f46\u662f\u6700\u8fd1\u5728\u7ed9\u6a21\u578b\u5c01\u88c5 webapi \u7684\u65f6\u5019\u6211\u840c\u751f\u7591\u95ee\uff1a</p>\n<ol>\n<li>\u5bf9\u4e8e\u8ba1\u7b97\u5bc6\u96c6\u578b\u7684\u670d\u52a1\u662f\u5426\u8fd8\u9700\u8981 Gunicorn+ Gevent</li>\n<li>\u5bf9\u4e8e\u95ee\u9898 1 \u662f\u5426\u9700\u8981\u533a\u5206 gpu \u90e8\u7f72\u573a\u666f\u548c cpu \u90e8\u7f72\u573a\u666f</li>\n</ol>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/kaiger", 
        "name": "kaiger", 
        "avatar": "https://cdn.v2ex.com/avatar/b4a6/ce0d/521752_large.png?m=1680588908"
      }, 
      "url": "https://www.v2ex.com/t/885846", 
      "title": "\u6c42\u52a9\uff0c\u5173\u4e8e Flask-Mail \u7684\u5927\u5751\u3002", 
      "id": "https://www.v2ex.com/t/885846", 
      "date_published": "2022-10-10T09:05:52+00:00", 
      "content_html": "<p>\u521d\u59cb\u5316\u4ee3\u7801\uff1a</p>\n<pre><code>app = create_app()\n# mail client\nmail = Mail(app)\n\n</code></pre>\n<p>\u914d\u7f6e\u6587\u4ef6\uff1a</p>\n<pre><code># flask_mail\nMAIL_DEBUG = False\nMAIL_SUPPRESS_SEND = False\nMAIL_SERVER = 'smtp.qq.com'\nMAIL_PORT = 465\nMAIL_USE_SSL = True\nMAIL_USE_TLS = False\nMAIL_USERNAME = os.getenv(\"MAIL_USERNAME\") or \"xxxx@qq.com\"\nMAIL_PASSWORD = os.getenv(\"MAIL_PASSWORD\") or \"xxxxxxxxxxx\"\t# QQ \u90ae\u7bb1\u6388\u6743\u7801\n</code></pre>\n<p>\u53d1\u9001\u90ae\u4ef6\u4ee3\u7801\uff1a</p>\n<pre><code>@celery.task\ndef send(mail_from, mail_to, subject=\"\", content=\"\", html=\"\"):\n    try:\n        msg = Message(\n            subject=subject,\n            sender=mail_from,\n            recipients=[mail_to]\n        )\n        msg.body = content\n        msg.html = html\n\n        mail.send(msg)\n    except Exception as e:\n        return e.__str__()\n\n    return \"ok\"\n\nsend.delay(\"xxxx@qq.com\", \"xxxxx@qq.com\", \"test\", \"content\")\n</code></pre>\n<p>\u9519\u8bef\u4fe1\u606f\uff1a</p>\n<pre><code>(535, b'Login Fail. Please enter your authorization code to login. More information in              \n                    http://service.mail.qq.com/cgi-bin/help?subtype=1&amp;&amp;id=28&amp;&amp;no=1001256')                              \n</code></pre>\n<p>\u4e0d\u77e5\u9053\u54ea\u91cc\u51fa\u4e86\u95ee\u9898\uff0c\u5230\u7f51\u4e0a\u641c\u4e86\u4e00\u5708\uff0c\u8fd9\u4e2a\u914d\u7f6e\u6ca1\u9519\uff0c\u5c31\u662f\u8d26\u6237\u9a8c\u8bc1\u5931\u8d25\uff0c\u5c31\u5f88\u96be\u53d7\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/elboble", 
        "name": "elboble", 
        "avatar": "https://cdn.v2ex.com/gravatar/3427d21885aca1e4e2149b2fdcf1b799?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/882842", 
      "title": "flask \u7528 sqlalchemy \u65f6\uff0c\u4e3a\u4ec0\u4e48\u4e00\u5b9a\u8981\u7528 flask-sqlalchemy\uff1f", 
      "id": "https://www.v2ex.com/t/882842", 
      "date_published": "2022-09-25T12:17:07+00:00", 
      "content_html": "<p>\u6211\u7684\u610f\u601d\u662f\uff0c\u5355\u72ec\u7528 sqlalchemy \u4e5f\u53ef\u4ee5\u5bf9\u6570\u636e\u5e93\u64cd\u4f5c\uff0c\u8fd8\u81ea\u5982\u4e00\u70b9\u3002\n\u6ca1\u770b\u51fa flask-sqlalchemy \u6709\u4ec0\u4e48\u66f4\u9ad8\u5c42\u6b21\u7684\u5c01\u88c5\u3002</p>\n<p>django \u548c\u4ed6\u7684 orm \u7ed3\u5408\u7d27\u5bc6\uff0c\u4f46\u662f flask \u4f3c\u4e4e\u5e76\u4e0d\u662f\u7684\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/kaiger", 
        "name": "kaiger", 
        "avatar": "https://cdn.v2ex.com/avatar/b4a6/ce0d/521752_large.png?m=1680588908"
      }, 
      "url": "https://www.v2ex.com/t/879476", 
      "title": "flask \u89c6\u56fe\u4e4b\u95f4\u5982\u4f55\u4f20\u9012 class \u5b9e\u4f8b ?", 
      "id": "https://www.v2ex.com/t/879476", 
      "date_published": "2022-09-12T09:27:06+00:00", 
      "content_html": "<p>\u5982\u9898\uff0c\u5728\u5176\u4e2d\u4e00\u4e2a\u89c6\u56fe\u5b9e\u4f8b\u5316\u4e00\u4e2a class \uff0c\u5982\u4f55\u5c06\u8fd9\u4e2a\u5b9e\u4f8b\u4f20\u9012\u5230\u4e0b\u4e00\u4e2a\u89c6\u56fe?</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/qile1", 
        "name": "qile1", 
        "avatar": "https://cdn.v2ex.com/gravatar/03b6474fdca2de3813a9860d19acdaf8?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/842222", 
      "date_modified": "2022-04-07T13:06:40+00:00", 
      "content_html": "\u5982\u9898\uff0c\u5fae\u4fe1\u516c\u4f17\u53f7\u5c0f\u7a0b\u5e8f\u53ca\u652f\u4ed8\u5b9d\u8fd9\u4e9b\u6709\u4e2a\u670d\u52a1\u5668 token \uff0c\u4e00\u822c\u8d85\u65f6 7200 \uff0c\u7528\u8fd9\u4e9b web \u6846\u67b6\u5f00\u53d1\u5982\u4f55\u5171\u4eab\u8fd9\u4e2a token \u5462\uff0c\u8d85\u65f6\u540e\u66f4\u65b0\u4e86\u5982\u4f55\u91cd\u65b0\u8bfb\u53d6\uff1f<br /><br />\u8c22\u8c22<br /><br /><br /><br />\u6211\u73b0\u5728\u4f7f\u7528\u7684\u65b9\u6cd5\u662f\uff0c\u76f4\u63a5 json \u4fdd\u5b58\u5230\u672c\u5730\u786c\u76d8\u6587\u4ef6\u91cc\u9762\uff0c\u6bcf\u6b21\u670d\u52a1\u5668\u8c03\u7528\u5c31\u8bfb\u53d6\u4e00\u6b21\uff0c\u5224\u65ad\u65f6\u95f4\uff0c\u5982\u679c\u8d85\u65f6\u5c31\u66f4\u65b0\u5e76\u91cd\u65b0\u5199\u5165\u6587\u4ef6\uff0c\u611f\u89c9\u8fd9\u6837\u4e0d\u592a\u5408\u7406\uff0c\u7528 sqlite \u597d\u50cf\u591a\u4e2a\u8fdb\u7a0b\u8bfb\u53d6\u4e5f\u4e0d\u592a\u5408\u9002\uff0c\u5176\u4ed6\u6570\u636e\u5e93\u4e5f\u6709\u70b9\u6d6a\u8d39\uff0c\u7528 radis \u662f\u4e0d\u662f\u4e5f\u6709\u70b9\u6d6a\u8d39\uff0c\u5927\u5bb6\u6709\u6ca1\u6709\u597d\u529e\u6cd5\uff1f window \u7684\u6ce8\u518c\u8868\u53ef\u4ee5\u4e0d\uff1f<br /><br />\u73b0\u5728\u63a5\u53e3\u8c03\u7528\u91cf\u6bcf\u5929 12w \u6b21\u5427", 
      "date_published": "2022-03-22T16:27:16+00:00", 
      "title": "flask \u548c fastapi \u53ca bottle \u5982\u4f55\u591a\u8fdb\u7a0b\u5171\u4eab\u8ba4\u8bc1 token", 
      "id": "https://www.v2ex.com/t/842222"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/easonl", 
        "name": "easonl", 
        "avatar": "https://cdn.v2ex.com/avatar/9f6d/ebc7/370570_large.png?m=1657006668"
      }, 
      "url": "https://www.v2ex.com/t/801200", 
      "title": "\u5b89\u88c5 Flask \u7684\u65f6\u5019\u63d0\u793a\u6ca1\u6709 flask \u8fd9\u4e2a module\uff0c\u65e0\u89e3\uff1f", 
      "id": "https://www.v2ex.com/t/801200", 
      "date_published": "2021-09-11T04:01:14+00:00", 
      "content_html": "<p>\u65b0\u624b\u5b66\u4e60 Python \u548c \u642d\u5efa Flask \u670d\u52a1\u3002</p>\n<p>\u6309\u7167\u65b0\u624b\u6751\u6559\u7a0b\uff0c\u4e00\u5f00\u59cb pip3 install flask\n\u5b89\u88c5\u5b8c\u6bd5\u540e\uff0c\u8fd0\u884c\u65b0\u624b\u6751 HelloWorld \u7a0b\u5e8f\uff0c\u63d0\u793a ImportError: No module named 'flask'</p>\n<p>\u4e8e\u662f\uff0cpip3 uninstall flask</p>\n<p>\u91c7\u7528\u624b\u5de5\u5b89\u88c5\u7684\u65b9\u5f0f\uff0cgit \u4e86 flask \u5230\u672c\u5730</p>\n<p>cd flask \u8fdb\u5165\u76ee\u5f55</p>\n<p>\u6267\u884c\u5b89\u88c5 </p>\n<p>python3 <a href=\"http://setup.py\" rel=\"nofollow\">setup.py</a> install</p>\n<p>\u7136\u540e\uff0c</p>\n<p>\u63d0\u793a\uff1aImportError: No module named 'flask'</p>\n<p>\u597d\u5427\uff0c\u6211\u53bb\u8003\u9a7e\u7167\uff0c\u4ea4\u8b66\u544a\u77e5\u6211\u6ca1\u6709\u9a7e\u7167\uff0c\u6240\u4ee5\u4e0d\u5141\u8bb8\u8003\u9a7e\u7167\u2026\u2026</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/huichao", 
        "name": "huichao", 
        "avatar": "https://cdn.v2ex.com/avatar/d342/799b/524204_large.png?m=1608200617"
      }, 
      "url": "https://www.v2ex.com/t/736718", 
      "title": "\u5927\u70b9\u513f\u7684\u9879\u76ee\u4f60\u4f1a\u9009\u62e9 flask \u5f00\u53d1 api \u5417\uff1f", 
      "id": "https://www.v2ex.com/t/736718", 
      "date_published": "2020-12-18T04:20:35+00:00", 
      "content_html": ""
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/JasonLaw", 
        "name": "JasonLaw", 
        "avatar": "https://cdn.v2ex.com/gravatar/4fdf59ece7cd78f432ec513634889579?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/728671", 
      "title": "\u8bbf\u95ee\u4e0d\u5230\u8fd0\u884c\u5728 docker \u91cc\u9762\u7684 flask \u5e94\u7528", 
      "id": "https://www.v2ex.com/t/728671", 
      "date_published": "2020-11-24T05:00:04+00:00", 
      "content_html": "<p><a href=\"http://server.py\" rel=\"nofollow\">server.py</a> \u7684\u5173\u952e\u5185\u5bb9\u5982\u4e0b\uff1a</p>\n<pre><code>if __name__ == '__main__':\n    app.run(host='0.0.0.0', port=9000)\n</code></pre>\n<p>Dockerfile \u5982\u4e0b\uff1a</p>\n<pre><code>FROM python:3.7-buster\n\nWORKDIR /app/\n\nCOPY ./requirements.txt /app/requirements.txt\nRUN pip3 install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/\n\nCOPY . /app/\n\nEXPOSE 9000\nENV FLASK_APP=server.py\nCMD python -m flask run --host=0.0.0.0 -p 9000\n</code></pre>\n<p>\u4e0b\u9762\u8fd9\u6837\u5b50\u53ef\u4ee5\u8bbf\u95ee\u5230 localhost:9000 \u3002</p>\n<pre><code>docker container run --name user-info-pool-service -d -p 9000:9000 user-info-pool-service\n</code></pre>\n<p>\u4f46\u662f\u4e0b\u9762\u8fd9\u6837\u5374\u4e0d\u884c\u3002</p>\n<pre><code>docker container run --network=host --name user-info-pool-service -d user-info-pool-service\n</code></pre>\n<p>\u771f\u7684\u597d\u5947\u602a\uff0c\u4e3a\u4ec0\u4e48\u5462\uff1f</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/lixuda", 
        "name": "lixuda", 
        "avatar": "https://cdn.v2ex.com/avatar/c6a0/553d/144103_large.png?m=1596246183"
      }, 
      "url": "https://www.v2ex.com/t/696988", 
      "title": "\u5982\u4f55\u4f18\u96c5\u5347\u7ea7 Python web \u7a0b\u5e8f", 
      "id": "https://www.v2ex.com/t/696988", 
      "date_published": "2020-08-10T02:39:32+00:00", 
      "content_html": "<p>\u5c0f\u5f1f\u4e0d\u624d\uff0c\u6240\u4ee5\u6c42\u5927\u795e\u3002</p>\n<p>\u4e4b\u524d\u662f\u5f00\u6e90\u7684 php \u7a0b\u5e8f\uff0c\u5982\u679c\u4ee3\u7801\u5347\u7ea7\uff0c\u64cd\u4f5c\u90fd\u662f\u8fdb\u5165\u540e\u53f0\uff0c\u6253\u5f00\u5173\u95ed\u7f51\u7ad9\uff0c\u7136\u540e ftp \u4e0a\u4f20\u4ee3\u7801\uff0c\u518d\u6253\u5f00\u7f51\u7ad9\u3002\n\u7f51\u7ad9\u6709\u4e00\u5b9a\u6570\u91cf\u7684\u4f1a\u5458\u8bbf\u95ee\u3002</p>\n<p>\u540e\u6765\u81ea\u5df1\u7528 flask \u91cd\u5199\u4e86\u4ee3\u7801\uff0c\nnginx+gunicorn+flask \u90e8\u7f72\uff0c\u4ee3\u7801\u7528 git \u62c9\u53d6\uff0c\n\u73b0\u5728\u66f4\u65b0\u7f51\u7ad9\u65b9\u5f0f\uff1a\n\u4ee3\u7801\u7528 git \u62c9\u53d6,\u7136\u540e\npstree -ap|grep gunicorn\nkill -HUP PID</p>\n<p>\u611f\u89c9\u5f88\u602a\u5f02\uff0c\u7279\u6765\u95ee\u95ee\u5927\u5bb6\u6709\u4ec0\u4e48\u597d\u65b9\u5f0f\uff1f\u8c22\u8c22</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/ropon", 
        "name": "ropon", 
        "avatar": "https://cdn.v2ex.com/avatar/95bb/9375/185993_large.png?m=1745742896"
      }, 
      "url": "https://www.v2ex.com/t/694457", 
      "title": "flask_restful json \u8fd4\u56de\u9ed8\u8ba4 Content-Type \u4ee5\u53ca\u4e2d\u6587\u4e71\u7801", 
      "id": "https://www.v2ex.com/t/694457", 
      "date_published": "2020-07-30T14:44:26+00:00", 
      "content_html": "<ul>\n<li>json \u8fd4\u56de\u9ed8\u8ba4 Content-Type: application/json\uff0c\u975e\u9ed8\u8ba4 utf-8 \u7f16\u7801(\u6bd4\u5982 Edge \u3001Safari)\u6d4f\u89c8\u5668\u6d4b\u8bd5\u4e2d\u6587\u4e71\u7801\uff1f</li>\n</ul>\n<pre><code>login_bp = Blueprint(\"login_bp\", __name__, url_prefix=\"/api/v1\")\nclass LoginView(Resource):\n    @marshal_with(user_fields)\n    def get(self):\n        users = User.query.all()\n        # print(users)\n        return users\n        # return {\"code\":0 ,\"msg\": \"\u4e2d\u6587\u6d4b\u8bd5\"}\napi.add_resource(LoginView, \"/login\")\n</code></pre>\n<ul>\n<li>\u5982\u679c Content-Type: application/json;charset=utf-8 \u6b63\u5e38\uff0c\u8bf7\u95ee\u5982\u4f55\u5904\u7406\u5462\uff1f\n<img alt=\"\" src=\"https://ftp.bmp.ovh/imgs/2020/07/3d546efd8b2dea64.jpg\"/>\n<img alt=\"\" src=\"https://ftp.bmp.ovh/imgs/2020/07/7a171b2ca66b256f.jpg\"/></li>\n</ul>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/lonisletend", 
        "name": "lonisletend", 
        "avatar": "https://cdn.v2ex.com/avatar/f789/5373/261522_large.png?m=1767173675"
      }, 
      "url": "https://www.v2ex.com/t/690025", 
      "title": "\u5173\u4e8e Flask-Login \u7684 user_loader \u56de\u8c03\u65b9\u6cd5\u7684\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/690025", 
      "date_published": "2020-07-14T11:11:08+00:00", 
      "content_html": "<p>\u5173\u4e8e<code>Flask-Login</code>\u7684<code>user_loader</code>\u56de\u8c03\u65b9\u6cd5\u7684\u95ee\u9898</p>\n<p>\u524d\u4e24\u5929\u770b\u5230 lepture \u5173\u4e8e Flask \u9879\u76ee\u7ed3\u6784\u7684\u8fd9\u7bc7\u6587\u7ae0<a href=\"https://lepture.com/en/2018/structure-of-a-flask-project\" rel=\"nofollow\">https://lepture.com/en/2018/structure-of-a-flask-project</a>, \u52a8\u624b\u5b9e\u8df5\u4e00\u4e0b, \u4f46\u662f\u9047\u5230\u4e2a Flask-Login \u7684\u95ee\u9898, <code>user_loader</code>\u65b9\u6cd5\u653e\u5728\u54ea\u513f\u90fd\u4e0d\u597d\u4f7f, \u603b\u662f\u62a5<code>Exception: Missing user_loader or request_loader. Refer to <a href=\"http://flask-login.readthedocs.io/#how-it-works\" rel=\"nofollow\">http://flask-login.readthedocs.io/#how-it-works</a> for more info.</code></p>\n<p>\u6211\u8ba4\u4e3a\u7684\u662f\u5728\u9879\u76ee\u542f\u52a8\u4e4b\u540e<code>login_manager</code>\u5df2\u7ecf\u548c<code>app</code>\u5173\u8054\u4e86, \u6240\u4ee5\u5728 router \u4e2d\u5f15\u7528\u7684<code>login_manager</code>\u5c31\u53ef\u4ee5\u8bbe\u7f6e<code>user_loader</code>\u56de\u8c03\u65b9\u6cd5\u4e86, \u4f46\u662f\u4e0d\u7ba1\u6211\u628a\u5b83\u653e\u54ea\u513f, \u59cb\u7ec8\u90fd\u627e\u4e0d\u5230, \u5728\u5f15\u7528<code>current_user</code>\u7684\u65f6\u5019\u5c31\u62a5\u9519 <code>Exception: Missing user_loader or request_loader. Refer to <a href=\"http://flask-login.readthedocs.io/#how-it-works\" rel=\"nofollow\">http://flask-login.readthedocs.io/#how-it-works</a> for more info.</code></p>\n<p>\u4e0b\u9762\u662f\u9879\u76ee\u7ed3\u6784, \u90e8\u5206\u6587\u4ef6\u622a\u56fe\u4ee5\u53ca\u62a5\u9519\u4fe1\u606f, \u8def\u8fc7\u7684\u5927\u795e\u9ebb\u70e6\u5e2e\u5fd9\u770b\u770b\u662f\u4ec0\u4e48\u95ee\u9898.</p>\n<ul>\n<li>\u9879\u76ee\u7ed3\u6784</li>\n</ul>\n<p><img alt=\"\" src=\"https://i.loli.net/2020/07/14/I534zDEimaj17QH.png\"/></p>\n<ul>\n<li><strong>init</strong>.py</li>\n</ul>\n<p><img alt=\"\" src=\"https://i.loli.net/2020/07/14/JvtHKxOaB5ksZgT.png\"/></p>\n<ul>\n<li><a href=\"http://auth.py\" rel=\"nofollow\">auth.py</a> (route)</li>\n</ul>\n<p><img alt=\"\" src=\"https://i.loli.net/2020/07/14/HFPCo9pYejZx8XA.png\"/></p>\n<ul>\n<li><a href=\"http://user.py\" rel=\"nofollow\">user.py</a> (\u7ee7\u627f\u4e86<code>flask_login</code>\u7684<code>UserMixin</code>\u7c7b)</li>\n</ul>\n<p><img alt=\"\" src=\"https://i.loli.net/2020/07/14/rTRVBaji1GWqPpC.png\"/></p>\n<ul>\n<li>\u62a5\u9519\u4fe1\u606f</li>\n</ul>\n<p><img alt=\"\" src=\"https://i.loli.net/2020/07/14/GFC3Oe5uts2gzZn.png\"/></p>\n<p>\u9ebb\u70e6\u5927\u795e\u4eec\u6307\u6559\u6216\u8005\u6709\u4ec0\u4e48\u601d\u8def\u8bf4\u8bf4, \u5148\u8c22\u8fc7.</p>\n<p><img alt=\"\" src=\"https://i.loli.net/2020/07/14/JNlHFZVSonQfARs.png\"/></p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/greyli", 
        "name": "greyli", 
        "avatar": "https://cdn.v2ex.com/avatar/e661/d57d/200057_large.png?m=1537084555"
      }, 
      "url": "https://www.v2ex.com/t/686674", 
      "title": "FlaskCon 2020 \u53c2\u4f1a\u6307\u5357", 
      "id": "https://www.v2ex.com/t/686674", 
      "date_published": "2020-07-02T12:18:15+00:00", 
      "content_html": "<p><a href=\"https://greyli.com/flaskcon-2020-guide/\" rel=\"nofollow\">https://greyli.com/flaskcon-2020-guide/</a></p>\n<p>FlaskCon \u662f\u7531\u793e\u533a\u4e3e\u529e\u7684\u514d\u8d39\u7ebf\u4e0a Flask \u4f1a\u8bae\uff0c\u6b22\u8fce\u53c2\u52a0\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/nanfangzai", 
        "name": "nanfangzai", 
        "avatar": "https://cdn.v2ex.com/avatar/63c6/cbf8/471811_large.png?m=1593567299"
      }, 
      "url": "https://www.v2ex.com/t/686131", 
      "title": "flask \u5982\u4f55\u9a8c\u8bc1 post \u63d0\u4ea4\u7684 json \u6570\u636e", 
      "id": "https://www.v2ex.com/t/686131", 
      "date_published": "2020-07-01T01:38:16+00:00", 
      "content_html": "<p>\u5927\u5bb6\u5728\u4f7f\u7528 flask \u65f6\uff0c\u90fd\u662f\u600e\u4e48\u9a8c\u8bc1 post \u63d0\u4ea4\u7684 json \u6570\u636e\u554a\uff1f \u6211\u73b0\u5728\u90fd\u662f\u7528 if \u6765\u5224\u65ad\u5404\u4e2a\u5b57\u6bb5\u662f\u5426\u7b26\u5408\u8981\u6c42\uff0c\u4f46\u662f\u663e\u5f97\u4ee3\u7801\u592a\u4e0d\u597d\u770b\u4e86\uff0c\u5927\u5bb6\u6709\u4ec0\u4e48\u5efa\u8bae\u5417\uff1f</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Livid", 
        "name": "Livid", 
        "avatar": "https://cdn.v2ex.com/avatar/c4ca/4238/1_large.png?m=1775624785"
      }, 
      "url": "https://www.v2ex.com/t/666124", 
      "date_modified": "2020-04-25T18:36:00+00:00", 
      "content_html": "\u5b98\u65b9\u6587\u6863\u91cc\u6ca1\u6709\u63d0\uff1a<br /><br /><a target=\"_blank\" href=\"https://flask.palletsprojects.com/en/1.1.x/tutorial/static/\" rel=\"nofollow noopener\">https://flask.palletsprojects.com/en/1.1.x/tutorial/static/</a><br /><br />\u76ee\u524d\u627e\u5230\u7684\u4e00\u4e9b\u5b9e\u73b0\u65b9\u5f0f\u90fd\u662f\u7b2c\u4e09\u65b9\u7684\uff1a<br /><br /><a target=\"_blank\" href=\"https://pythonhosted.org/Flask-Versioned/\" rel=\"nofollow noopener\">https://pythonhosted.org/Flask-Versioned/</a><br /><br /><a target=\"_blank\" href=\"https://ana-balica.github.io/2014/02/01/autoversioning-static-assets-in-flask/\" rel=\"nofollow noopener\">https://ana-balica.github.io/2014/02/01/autoversioning-static-assets-in-flask/</a>", 
      "date_published": "2020-04-25T18:32:00+00:00", 
      "title": "Flask \u7684\u9759\u6001\u8d44\u6e90 URL \u7684 versioning \u76ee\u524d\u6709\u5b98\u65b9\u652f\u6301\u7684 best practice \u4e48\uff1f", 
      "id": "https://www.v2ex.com/t/666124"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/miniyao", 
        "name": "miniyao", 
        "avatar": "https://cdn.v2ex.com/avatar/986e/3747/237684_large.png?m=1515160726"
      }, 
      "url": "https://www.v2ex.com/t/660989", 
      "title": "\u5149\u5934\u5927\u53d4\u7684 Flask \u6559\u7a0b\u91cc\uff0c\u5168\u6587\u641c\u7d22\u7684\u90e8\u5206 def search(cls, expression, page, per_page) \uff0c cls \u4ee3\u8868\u4ec0\u4e48\u610f\u601d\u5440\uff1f\u4e0d\u662f\u592a\u7406\u89e3", 
      "id": "https://www.v2ex.com/t/660989", 
      "date_published": "2020-04-09T16:19:43+00:00", 
      "content_html": "<p><a href=\"http://github.com/miguelgrinberg/microblog/blob/master/app/models.py\" rel=\"nofollow\">github.com/miguelgrinberg/microblog/blob/master/app/models.py</a> # line 19</p>\n<p>\u5168\u6587\u641c\u7d22\u7684\u7c7b\u53d8\u91cf\u91cc\uff0c\u4f20\u7684 cls \u662f\u4ec0\u4e48\u610f\u601d\uff1f\u4e0d\u662f\u592a\u7406\u89e3\uff1a</p>\n<pre><code>class SearchableMixin(object):\n    @classmethod\n    def search(cls, expression, page, per_page):\n        ids, total = query_index(cls.__tablename__, expression, page, per_page)\n        if total == 0:\n            return cls.query.filter_by(id=0), 0\n        when = []\n        for i in range(len(ids)):\n            when.append((ids[i], i))\n        return cls.query.filter(cls.id.in_(ids)).order_by(\n            db.case(when, value=cls.id)), total\n......\n\n</code></pre>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/miniyao", 
        "name": "miniyao", 
        "avatar": "https://cdn.v2ex.com/avatar/986e/3747/237684_large.png?m=1515160726"
      }, 
      "url": "https://www.v2ex.com/t/644133", 
      "title": "\u8df3\u8f6c abc.com/?q=foo \u7528 Flask-Login \u7684 next \u4f20\u53c2\uff0c\u9700\u8981\u52a0\u659c\u6760\u5417\uff1f", 
      "id": "https://www.v2ex.com/t/644133", 
      "date_published": "2020-02-12T13:24:45+00:00", 
      "content_html": "<p>\u8bbf\u95ee <a href=\"http://abc.com/?q=foo\" rel=\"nofollow\">abc.com/?q=foo</a> \u8def\u7531\uff0c\u8df3\u767b\u5f55\uff0c\u7136\u540e\u628a\u8def\u5f84\u53c2\u6570\u7528 next \u4f20\u8fdb\u53bb\uff1a</p>\n<pre><code>return redirect(url_for('auth.login', next='?q=foo'))\n</code></pre>\n<pre><code>return redirect(url_for('auth.login', next='/?q=foo'))\n</code></pre>\n<p>\u867d\u7136\u4e0a\u9762\u4e24\u79cd\u5199\u6cd5\u7ed3\u679c\u90fd\u4e00\u6837\uff0c\u90a3\u79cd\u5199\u6cd5\u66f4\u7b26\u5408\u89c4\u8303\u5462\uff1f</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/hosinokamui", 
        "name": "hosinokamui", 
        "avatar": "https://cdn.v2ex.com/gravatar/8410d0ce4635addcee6d61cdcf142239?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/635753", 
      "date_modified": "2022-03-08T15:27:33+00:00", 
      "content_html": "\u5982\u679c\u6761\u4ef6\u4e3a None\uff0c\u600e\u6837\u80fd\u8fd4\u56de\u6240\u6709\u7684\u6570\u636e\u5462\uff0c\u73b0\u5728\u662f\u76f4\u63a5\u5728 sql \u91cc\u53d8\u6210\u201cwhere \u5b57\u6bb5 IS NULL\u201d\u4e86", 
      "date_published": "2020-01-07T04:52:35+00:00", 
      "title": "\u5c0f\u767d\u6c42\u52a9\uff0c flask_sqlalchemy \u6761\u4ef6\u67e5\u8be2\u7684\u4e00\u4e2a\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/635753"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/xiaojiantao", 
        "name": "xiaojiantao", 
        "avatar": "https://cdn.v2ex.com/gravatar/bf4e2998648285ba31ab78729958344b?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/631843", 
      "title": "flask \u81ea\u5efa\u670d\u52a1\u5668", 
      "id": "https://www.v2ex.com/t/631843", 
      "date_published": "2019-12-24T05:55:13+00:00", 
      "content_html": "<p>\u9700\u6c42\uff1a\u5728 linux \u4e0a\u7528 flask \u642d\u5efa\u4e00\u4e2a\u9759\u6001\u670d\u52a1\u5668\uff08\u89c6\u9891\u8f83\u591a\uff09\uff08\u56e0\u4e3a\u9a8c\u8bc1\u65b9\u5f0f\u6bd4\u8f83\u72ec\u7279\uff0c\u8fd8\u9700\u8981\u52a0\u89e3\u5bc6\u4ec0\u4e48\u7684\uff0c\u6240\u4ee5\u6ca1\u6cd5\u7528 nginx \u5565\u7684\uff09</p>\n<p>\u7528\u9014\uff1a\u653e\u5728\u7f51\u7ad9\u4e0a\u4f7f\u7528 video \u6807\u7b7e\u64ad\u653e</p>\n<p>\u95ee\u9898\uff1avideo \u6807\u7b7e\u7684 html \u64ad\u653e\u4f3c\u4e4e\u90fd\u662f\u5728\u8fb9\u52a0\u8f7d\u8fb9\u64ad\u653e\uff0c\u8fd8\u53ef\u4ee5\u8df3\u8fdb\u5ea6\u4ec0\u4e48\u7684\u3002\u6d4f\u89c8\u5668\u662f\u600e\u4e48\u8bf7\u6c42\u670d\u52a1\u5668\u7684\uff1f\u6211\u5e94\u8be5\u5728\u670d\u52a1\u5668\u4e0a\u600e\u4e48\u8fd9\u6837\u7684\u7a0b\u5e8f\uff1f\u662f\u65ad\u70b9\u7eed\u4f20\u90a3\u6837\u52a0\u8f7d\u7684\u5417\uff1f</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/HTSdTt3WygdgQQGe", 
        "name": "HTSdTt3WygdgQQGe", 
        "avatar": "https://cdn.v2ex.com/gravatar/aacd38874f72302ae6dd06b73fd0918e?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/629944", 
      "date_modified": "2019-12-18T00:50:00+00:00", 
      "content_html": "<p>\u914d\u4e86\u4e00\u5929\u4e86,\u53c8\u662f nginx \u53c8\u662f uWSGI \u53c8\u662f Gunicorn,\u5927\u4f6c\u53ef\u6709 Docker \u4e00\u952e\u90e8\u7f72\u7684\u73af\u5883</p>\n", 
      "date_published": "2019-12-17T13:40:12+00:00", 
      "title": "Flask \u751f\u4ea7\u73af\u5883\u597d\u96be\u914d\u7f6e", 
      "id": "https://www.v2ex.com/t/629944"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/miniyao", 
        "name": "miniyao", 
        "avatar": "https://cdn.v2ex.com/avatar/986e/3747/237684_large.png?m=1515160726"
      }, 
      "url": "https://www.v2ex.com/t/618078", 
      "title": "\u6c42\u52a9\uff0c\u90a3\u4f4d\u540c\u5b66\u6709\u770b\u8fc7\u8fd9\u4e2a\u89c6\u9891 four sqlalchemy tips\uff0c\u53ef\u4ee5\u8d34\u4e0b Tips \u5417\uff1f", 
      "id": "https://www.v2ex.com/t/618078", 
      "date_published": "2019-11-10T03:40:16+00:00", 
      "content_html": "\u5149\u5934\u8001\u5e08\u7684 video: four sqlalchemy tips\uff0c\u89c6\u9891\u5730\u5740\uff1a<a target=\"_blank\" href=\"http://youtu.be/5-4W3m5gRAs\" rel=\"nofollow\">youtu.be/5-4W3m5gRAs</a><br /><br />\u4eca\u5929\u7684\u68af\u5b50\u6302\u4e86\uff0c\u56fd\u5185\u597d\u50cf\u8fd8\u6ca1\u641c\u5230\u8fd9\u4e2a\u89c6\u9891\u7684\u642c\u8fd0"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/darkerrry", 
        "name": "darkerrry", 
        "avatar": "https://cdn.v2ex.com/gravatar/22ad7262f0581c325728332cceda7986?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/593860", 
      "title": "\u5173\u4e8e flask \u90ae\u7bb1\uff0c\u5fae\u4fe1\u62a5\u8b66\u529f\u80fd\u53ef\u7528\u6027\u76d1\u6d4b\u5982\u4f55\u5b9e\u73b0\u7684\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/593860", 
      "date_published": "2019-08-21T07:04:16+00:00", 
      "content_html": "<p>\u840c\u65b0\u63d0\u95ee\uff1a\u6700\u8fd1\u5728\u7528 flask \u5199\u5fae\u4fe1\uff0c\u90ae\u7bb1\u62a5\u8b66\u7684\u529f\u80fd\uff0c\u5c31\u662f\u51fa\u6545 bug \u4ee5\u540e\u8981\u7528\u5fae\u4fe1\u6216\u8005\u90ae\u7bb1\u5c06\u9519\u8bef\u53d1\u9001\u5230\u76f8\u5bf9\u5e94\u7684\u63a5\u6536\u65b9\u3002\u5199\u5b8c\u4e4b\u540e\u8981\u505a\u4e2a\u53ef\u7528\u6027\u76d1\u6d4b\uff0c\u4e5f\u5c31\u662f\u5b9a\u65f6\uff08\u6bd4\u5982\u6bcf 5 \u79d2\uff09\u6267\u884c\u8fd9\u4e9b\u4efb\u52a1\uff08\u4e0d\u53d1\u9001\u90ae\u4ef6\u4f46\u662f\u8fd0\u884c\uff09\uff0c\u4e00\u65e6\u51fa\u73b0\u62a5\u9519\u4e5f\u8981\u53d1\u9001\u4fe1\u606f\u3002\n\u6211\u7684\u95ee\u9898\u662f\u5982\u4f55\u5b9a\u65f6\u53d1\u9001\u8bf7\u6c42\uff0c\u7a0b\u5e8f\u9700\u8981\u53d1\u8d77\u8bf7\u6c42\u540e\u624d\u80fd\u53d1\u9001\u90ae\u4ef6\u548c\u5fae\u4fe1\u3002\u6211\u7684\u60f3\u6cd5\u662f\u5c06\u53d1\u8d77\u8bf7\u6c42\u7684\u547d\u4ee4\u884c\u5199\u5230\u670d\u52a1\u5668\u7684\u51fd\u6570\u91cc\u9762\uff0c\u4e00\u65e6\u542f\u52a8\u670d\u52a1\u5668\u5c31\u8fd0\u884c\u7a0b\u5e8f\uff0c\u5b9e\u73b0\u4e4b\u540e\u7528\u591a\u7ebf\u7a0b\u8fd0\u884c\uff0c\u5e76\u7528 sleep \u51fd\u6570\u5bf9\u4ed6\u4eec\u5b9a\u65f6\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/admingyu", 
        "name": "admingyu", 
        "avatar": "https://cdn.v2ex.com/gravatar/1a86463641308c833798c6fdd42fdbc0?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/592021", 
      "date_modified": "2019-08-15T02:04:24+00:00", 
      "content_html": "<h3>Flask \u540e\u7aef\u5f00\u53d1\uff0c\u73b0\u5728\u516c\u53f8\u6709\u4e2a\u9700\u6c42\u662f\u5c06 excel \u8868\u5185\u7684\u6570\u636e\u5bfc\u5165\u5230\u6570\u636e\u5e93\uff08\u5b57\u6bb5\u4e0d\u662f\u4e00\u4e00\u5bf9\u5e94\u7684\uff0c\u6709\u4e9b\u5b57\u6bb5\u4e0d\u9700\u8981\uff09\uff0c\u8981\u6c42\u8fd4\u56de\u5bfc\u5165\u6210\u529f\u6570\u91cf\uff0c\u5bfc\u5165\u5931\u8d25\u6570\u91cf\uff0c\u4ee5\u53ca\u5177\u4f53\u54ea\u51e0\u6761\u6570\u636e\u5bfc\u5165\u5931\u8d25\uff0c\u6210\u529f\u7684\u6570\u636e\u8981\u5165\u5e93\u3002</h3>\n<p><strong>\u76ee\u524d\u7684\u65b9\u6cd5\u662f\uff1a</strong>\n<code>sqlalchemy</code> + <code>xlrd</code></p>\n<ol>\n<li>\u5bfc\u5165\u6570\u636e\u5e93\u7528<code>db.session.bulk_insert_mappings()</code></li>\n<li>\u68c0\u67e5\u54ea\u51e0\u6761\u6570\u636e\u4e0d\u6210\u529f\u7528\u7684\u662f<code>\u628a\u6570\u636e\u67e5\u51fa\u6765\u548c excel \u5185\u7684\u6570\u636e\u505a\u5bf9\u6bd4</code></li>\n</ol>\n<p>-- \u4f46\u662f\u611f\u89c9 2 \u8fd9\u6837\u505a\u597d\u8822\uff0c\u4e0d\u77e5\u9053\u6709\u6ca1\u6709\u4ec0\u4e48\u66f4\u597d\u7684\u65b9\u6cd5\uff0c\u6709\u4eba\u5206\u4eab\u4e0b\u5417</p>\n", 
      "date_published": "2019-08-15T02:03:09+00:00", 
      "title": "excel \u6279\u91cf\u5bfc\u5165\u6570\u636e\u5e93\u5e76\u8fd4\u56de\u5bfc\u5165\u60c5\u51b5\u7684\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/592021"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/kayseen", 
        "name": "kayseen", 
        "avatar": "https://cdn.v2ex.com/avatar/6c5f/f437/384348_large.png?m=1586510108"
      }, 
      "url": "https://www.v2ex.com/t/586092", 
      "date_modified": "2022-03-09T03:54:51+00:00", 
      "content_html": "<p>\u8bf7\u6559\u5927\u5bb6 flask \u7684\u91cd\u5b9a\u5411(\u4e0d\u4f7f\u7528 url_for \u91cd\u5b9a\u5411):\n\u5982\u4e0b: \u89c6\u56fe\u51fd\u6570 A \u7684 url \u4e3a\"127.0.0.1:8000/A\",\u5b83\u63a5\u53d7\u901a\u8fc7 post \u4f20\u9012\u8fc7\u6765\u7684\u53c2\u6570\u4e3a{\"name\":\"jay\"};\n\u89c6\u56fe\u51fd\u6570 B \u7684 url \u4e3a\"127.0.0.1:8000/B\";\n\u8bf7\u95ee\u600e\u4e48\u5728\u89c6\u56fe\u51fd\u6570 A \u4e2d\u4f7f\u7528 redirect \u91cd\u5b9a\u5411\u5230 B \u7684 url,\u540c\u65f6\u5c06 A \u901a\u8fc7\u8bf7\u6c42\u4f53\u63a5\u53d7\u7684\u53c2\u6570\u4e5f\u4f20\u9012\u7ed9 B,\u5728\u89c6\u56fe\u51fd\u6570 B \u4e2d\u4f7f\u7528\u8fd9\u4e2a\u53c2\u6570?</p>\n", 
      "date_published": "2019-07-25T04:51:17+00:00", 
      "title": "flask \u5728\u4f7f\u7528 redirect \u5bf9 url \u91cd\u5b9a\u5411\u7684\u65f6\u5019,\u600e\u4e48\u4f20\u9012\u8bf7\u6c42\u4f53?", 
      "id": "https://www.v2ex.com/t/586092"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/kayseen", 
        "name": "kayseen", 
        "avatar": "https://cdn.v2ex.com/avatar/6c5f/f437/384348_large.png?m=1586510108"
      }, 
      "url": "https://www.v2ex.com/t/585877", 
      "date_modified": "2022-03-20T11:11:38+00:00", 
      "content_html": "<p>\u6bd4\u5982\u6709\u4e24\u4e2a\u7cfb\u7edf: A \u7cfb\u7edf\u548c B \u7cfb\u7edf;\nA \u7cfb\u7edf\u91cc\u9762\u4fdd\u5b58\u7684\u662f\u73ed\u7ea7\u4fe1\u606f\u6570\u636e\u5e93;\nB \u7cfb\u7edf\u91cc\u9762\u4fdd\u5b58\u7684\u662f\u5b66\u751f\u4fe1\u606f\u6570\u636e\u5e93;\n\u7136\u540e A \u7cfb\u7edf\u90e8\u7f72\u5728\u4e00\u4e2a\u7aef\u53e3,B \u7cfb\u7edf\u90e8\u7f72\u5728\u4e00\u4e2a\u7aef\u53e3;\n\u4f46\u662f\u9700\u8981\u5728 A \u7cfb\u7edf\u67e5\u8be2\u548c\u4fee\u6539 B \u7cfb\u7edf\u7684\u6570\u636e\u5e93,\n\u8bf7\u95ee\u8fd9\u79cd\u9700\u6c42\u53ef\u4ee5\u5b9e\u73b0\u5417?</p>\n", 
      "date_published": "2019-07-24T09:47:00+00:00", 
      "title": "flask \u6846\u67b6,\u4e24\u4e2a\u7cfb\u7edf\u90fd\u6709\u5404\u81ea\u7684\u6570\u636e\u5e93,\u4e24\u4e2a\u7cfb\u7edf\u600e\u4e48\u5171\u7528\u5f7c\u6b64\u7684\u6570\u636e\u5e93,\u8bf7\u95ee\u5e94\u8be5\u600e\u4e48\u5b9e\u73b0?", 
      "id": "https://www.v2ex.com/t/585877"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/i80vs20", 
        "name": "i80vs20", 
        "avatar": "https://cdn.v2ex.com/gravatar/e054554193ecc5daeb8d01505e82c798?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/583245", 
      "title": "flask \u4e0e koa", 
      "id": "https://www.v2ex.com/t/583245", 
      "date_published": "2019-07-15T14:10:20+00:00", 
      "content_html": "<p>flask \u4e0e koa\uff0c\u8bbe\u8ba1\u7406\u5ff5\u771f\u7684\u6bd4\u8f83\u50cf\uff0c\u90fd\u662f\u975e\u5e38\u7b80\u6d01\u7684\u5185\u6838\uff0c\u5176\u5b83\u529f\u80fd\u90fd\u662f\u4ee5\u63d2\u4ef6\u7684\u5f62\u5f0f\u5f15\u5165\uff0c\u5b8c\u7f8e\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/ropon", 
        "name": "ropon", 
        "avatar": "https://cdn.v2ex.com/avatar/95bb/9375/185993_large.png?m=1745742896"
      }, 
      "url": "https://www.v2ex.com/t/580577", 
      "date_modified": "2019-07-06T06:23:13+00:00", 
      "content_html": "<pre><code>flask_restful.abort = api_abort\ndef api_abort( httpcode=400, errcode=None, message=None, key=\"\"):\n    res = BaseResponse()\n    res.errcode = errcode or 4011\n    if message:\n        res.errmsg = message\n    else:\n        res.errmsg = key + codetype.get(res.errcode)\n    res.dict.pop('data')\n    if httpcode == 200:\n        print(123456, res.dict)\n        return jsonify(res.dict), httpcode\n    return abort( httpcode, **res.dict)\n</code></pre>\n<pre><code>@app.after_request\n    def after_request(response):\n        # \u5141\u8bb8\u8de8\u57df\n        response.headers.add('Access-Control-Allow-Origin', '*')\n        if request.method == 'OPTIONS':\n            response.headers['Access-Control-Allow-Methods'] = 'POST, DELETE, PUT, GET'\n            headers = request.headers.get('Access-Control-Request-Headers')\n            if headers:\n                response.headers['Access-Control-Allow-Headers'] = headers\n        return response\n</code></pre>\n<p>\u5f53 return abort( httpcode, **res.dict) \u72b6\u6001\u7801 400 \u63d0\u793a\u8de8\u57df\n<img src=\"https://i.bmp.ovh/imgs/2019/07/9ab5c8f3cc91dcae.jpg\" alt=\"image\"></p>\n", 
      "date_published": "2019-07-06T06:21:16+00:00", 
      "title": "flask restful abort cross \u7591\u95ee", 
      "id": "https://www.v2ex.com/t/580577"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/hanssx", 
        "name": "hanssx", 
        "avatar": "https://cdn.v2ex.com/avatar/5912/4ca0/350569_large.png?m=1734523135"
      }, 
      "url": "https://www.v2ex.com/t/576816", 
      "title": "sqlalchemy \u4e2d column \u7c7b\u578b\u4e3a list \u7684\u60c5\u51b5", 
      "id": "https://www.v2ex.com/t/576816", 
      "date_published": "2019-06-24T02:34:26+00:00", 
      "content_html": "<p>\u73b0\u6709\u4e00\u4e2a\u9700\u6c42\uff0ctable \u4e2d\u67d0 column \uff08\u5047\u5b9a\u4e3a col_a \uff09\u6709\u591a\u4e2a\u987a\u5e8f\u9012\u589e\u7684\u65e5\u671f\uff08\u4e0d\u786e\u5b9a\u5217\u8868\u4e2d\u5230\u5e95\u6709\u591a\u5c11\u4e2a\u65e5\u671f\uff0c\u6240\u4ee5\u4e0d\u80fd\u56fa\u5b9a\u7684\u6784\u9020 N \u4e2a\u5b57\u6bb5\u6765\u5b58\uff09\uff0c\u6211\u53ef\u4ee5\u628a col_a \u7684\u7c7b\u578b\u8bbe\u7f6e\u6210 string \u6216\u8005 pickle \uff08\u8fd9\u4e2a\u5b58\u50a8\u7c7b\u578b\u4e0d\u91cd\u8981\uff09\u3002</p>\n<p>\u5728\u6784\u9020\u67e5\u8be2\u6761\u4ef6\u7684\u65f6\u5019\uff0c\u4f1a\u4f20\u5165\u4e00\u4e2a begin_time \u548c end_time\uff0c\u67e5\u8be2 col_a \u4e2d\u662f\u5426\u6709\u67d0\u4e2a\u65f6\u95f4\u5728 begin_time \u548c end_time \u4e4b\u95f4\uff0c\u5982\u679c\u6709\uff0c\u6761\u4ef6\u6210\u7acb\uff0c\u5426\u5219\u6761\u4ef6\u4e0d\u6210\u7acb\u3002</p>\n<p>\u6b63\u5e38\u6765\u8bf4\uff0c\u5982\u679c col_a \u662f\u4e00\u4e2a\u65e5\u671f\uff0csqlalchemy \u4e2d\u7528 between \u5c31\u53ef\u4ee5\u4e86\uff0c\u4f46\u662f\u73b0\u5728 col_a \u662f\u4e00\u4e2a\u6709\u591a\u4e2a\u9012\u589e\u65e5\u671f\u7684\u5217\u8868\uff0c\u539f\u751f sql \u6211\u90fd\u60f3\u4e0d\u51fa\u6765\u600e\u4e48\u5199\uff0csqlalchemy \u662f\u4e0d\u662f\u4e5f\u6ca1\u6cd5\u76f4\u63a5\u5199\u51fa\u6765\u3002</p>\n<p>\u76ee\u524d\u80fd\u60f3\u5230\u7684\u5c31\u662f\u5148\u53d6\u51fa\u6240\u6709 table \u7684\u8bb0\u5f55\uff0c\u904d\u5386\u4e00\u904d col_a \u5217\uff0c\u628a\u6240\u6709\u6ee1\u8db3\u6761\u4ef6\u7684\u8bb0\u5f55\u5b58\u50a8\u6210\u4e00\u4e2a\u4e34\u65f6\u8868\uff0c\u7136\u540e\u5728\u4e34\u65f6\u8868\u7684\u57fa\u7840\u4e0a\u518d\u6784\u9020\u5176\u4ed6\u67e5\u8be2\u6761\u4ef6\u3002</p>\n<p>\u8fd8\u6709\u5176\u4ed6\u65b9\u6848\u5417\uff1f\uff08\u611f\u89c9\u8fd9\u4e2a\u6709\u70b9\u86cb\u75bc\uff0c\u6211\u613f\u610f\u4e3a\u77e5\u8bc6\u4ed8\u8d39 20 \u5143\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/madpecker009", 
        "name": "madpecker009", 
        "avatar": "https://cdn.v2ex.com/avatar/cf57/0431/295022_large.png?m=1626616637"
      }, 
      "url": "https://www.v2ex.com/t/575889", 
      "title": "\u5173\u4e8e Flask \u6587\u6863", 
      "id": "https://www.v2ex.com/t/575889", 
      "date_published": "2019-06-20T08:47:49+00:00", 
      "content_html": "<p><a href=\"https://dormousehole.readthedocs.io/en/latest/quickstart.html#id13\" rel=\"nofollow\">https://dormousehole.readthedocs.io/en/latest/quickstart.html#id13</a>\n\u5927\u4f6c\u4eec\u8fd9\u4e2a\u5c31\u662f flask \u7684\u5b98\u65b9\u6587\u6863\u4e48?\u4e3a\u4ec0\u4e48\u611f\u89c9\u597d\u5c11\u554a\u3002\u3002\u3002\u6211\u662f\u4e0d\u662f\u770b\u5230\u4e86\u5047\u7684\u3002\u3002\u81ea\u5df1\u521a\u4ece php \u8f6c\u5230 python\u3002\u3002\u770b\u4e86\u8fd9\u4e2a\u6846\u67b6\u7684\u6587\u6863\u3002\u3002\u611f\u89c9\u3002\u3002\u597d\u5c11\u554a</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Wallace007", 
        "name": "Wallace007", 
        "avatar": "https://cdn.v2ex.com/gravatar/25ed1d355213b8b00a6b46980101d4e1?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/571738", 
      "title": "\u8bf7\u95ee flask \u521b\u5efa\u591a\u4e2a app \u5e94\u7528 \u6709\u4ec0\u4e48\u4e48\u7528\u5904\u5462", 
      "id": "https://www.v2ex.com/t/571738", 
      "date_published": "2019-06-07T02:40:43+00:00", 
      "content_html": "<p>\u5982\u9898\uff0cflask \u7a0b\u5e8f\u5fc5\u987b\u8981\u521b\u5efa\u4e00\u4e2a app \u5b9e\u4f8b\uff0c\u8fd9\u662f\u4e3a\u4e86\u53ef\u4ee5\u521b\u5efa\u591a\u4e2a app\uff0c\u4f46\u662f\u8fd9\u6837\u521b\u5efa\u591a\u4e2a app \u6709\u4ec0\u4e48\u7528\u5462\uff0c\u4e00\u4e2a\u96be\u9053\u4e0d\u591f\u5417</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/eagleweb", 
        "name": "eagleweb", 
        "avatar": "https://cdn.v2ex.com/gravatar/ef78c63153892817a7fe1c717806aea8?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/567795", 
      "title": "Flask \u670d\u52a1\u7aef\u600e\u4e48\u914d\u7f6e pjax", 
      "id": "https://www.v2ex.com/t/567795", 
      "date_published": "2019-05-26T08:19:33+00:00", 
      "content_html": ""
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Wallace007", 
        "name": "Wallace007", 
        "avatar": "https://cdn.v2ex.com/gravatar/25ed1d355213b8b00a6b46980101d4e1?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/562011", 
      "date_modified": "2019-05-07T15:21:57+00:00", 
      "content_html": "<p>\u4f8b\u5982\u4e00\u4e2a python flask \u7a0b\u5e8f\u7684\u8fd4\u56de\uff1a\n....\nreturn \"hello word\", 200, {\"Set-Cookie\":\"name=Wallace\"}</p>\n<p>\u7b2c\u4e00\u3001\u6211\u60f3\u518d\u6dfb\u52a0\u4e00\u4e2a age=18 \u7684 cookie \u503c\uff0c\u8be5\u600e\u4e48\u505a\u5462\uff08\u591a\u4e2a cookie \uff09\n\u7b2c\u4e8c\u3001\u5982\u4f55\u5728\u540d\u4e3a name \u7684 cookie \u91cc\u6dfb\u52a0\u591a\u4e2a\u5173\u952e\u5b57\u7684\u503c\u5462\uff0c\u6bd4\u5982\uff1aname={uuu \u201c:28,\u201d ttt \u201c:34}\u8fd9\u79cd\u7684\uff08\u4e00\u4e2a cookie \u91cc\u591a\u4e2a\u503c\uff09</p>\n", 
      "date_published": "2019-05-07T15:18:24+00:00", 
      "title": "\u8bf7\u95ee\u5982\u4f55\u6dfb\u52a0\u591a\u4e2a cookie \u503c\u5462", 
      "id": "https://www.v2ex.com/t/562011"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Hopetree", 
        "name": "Hopetree", 
        "avatar": "https://cdn.v2ex.com/avatar/38cb/fd52/265542_large.png?m=1714960392"
      }, 
      "url": "https://www.v2ex.com/t/547740", 
      "date_modified": "2019-03-23T08:12:15+00:00", 
      "content_html": "<p>\u6211\u60f3\u8bd5\u8bd5 flask \u7528 Redis \u505a\u7f13\u5b58\uff0c\u7136\u540e\u4e0a GitHub \u641c\u7d22\u7f13\u5b58\u7684\u63d2\u4ef6\uff0c\u53d1\u73b0\u4e86 2 \u4e2a\uff0c\u661f\u661f\u6570\u91cf\u4e5f\u592a\u4f4e\u4e86\u5427\uff0c\u6700\u91cd\u8981\u7684\u662f\u7b2c\u4e00\u4e2a\u662f\u4f7f\u7528\u6700\u591a\u7684\uff0c\u4f46\u662f\u8ddf\u65b0\u5c45\u7136\u505c\u7559\u5728\u4e86 7\u30018 \u5e74\u524d\uff0c\u73b0\u5728 python3 \u4f7f\u7528\u4f1a\u62a5\u9519\uff0c\u9700\u8981\u6539\u6e90\u7801\u624d\u80fd\u7528\u8fd9\u624d\u662f\u6700\u53ef\u6015\u7684\uff08\u6240\u4ee5\u80af\u5b9a\u4e0d\u4f1a\u7528\u8fd9\u4e2a\uff09\u3002\u7b2c\u4e8c\u4e2a<code>flask_caching</code> \u5012\u662f\u8ddf\u65b0\u7684\u6bd4\u8f83\u597d\uff0c\u4f7f\u7528\u4e5f\u5f88 OK\uff0c\u4f46\u662f\u6211\u5f88\u5947\u602a\u7684\u662f\uff0c\u96be\u9053\u5927\u5bb6\u90fd\u4e0d\u7528\u7b2c\u4e09\u65b9\u7684\u63d2\u4ef6\u4f5c\u4e3a\u7f13\u5b58\u5417\uff0c\u4e3a\u4ec0\u4e48\u661f\u661f\u90fd\u8fd9\u4e48\u5c11\uff1f</p>\n<p><strong>\u8865\u5145</strong> \u662f\u4e0d\u662f\u76f4\u63a5\u4f7f\u7528\u7684\u81ea\u5e26\u7684\u7f13\u5b58\uff1f\u6211\u53d1\u73b0\u81ea\u5e26\u7684\u4e5f\u662f\u53ef\u4ee5\u7528\u7684\uff0c\u5b8c\u5168 OK</p>\n<pre><code>from werkzeug.contrib.cache import RedisCache\n</code></pre>\n<p><img src=\"http://pic.tendcode.com/tendcode_2019-03-23_15-51-51.png\" alt=\"cache\"></p>\n", 
      "date_published": "2019-03-23T08:03:25+00:00", 
      "title": "flask \u7f13\u5b58\u63d2\u4ef6\u4e3a\u4ec0\u4e48\u4e0d\u7ef4\u62a4\u4e86\uff1f\u600e\u4e48\u8ddf django \u7684\u63d2\u4ef6\u7ef4\u62a4\u5dee\u8ddd\u8fd9\u4e48\u5927\uff1f", 
      "id": "https://www.v2ex.com/t/547740"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Hopetree", 
        "name": "Hopetree", 
        "avatar": "https://cdn.v2ex.com/avatar/38cb/fd52/265542_large.png?m=1714960392"
      }, 
      "url": "https://www.v2ex.com/t/547346", 
      "date_modified": "2019-03-22T03:50:26+00:00", 
      "content_html": "<p>\u770b\u5230\u4e00\u4e2a flask \u9879\u76ee\uff0c\u7ed3\u6784\u770b\u7684\u6211\u975e\u5e38\u559c\u6b22\uff0c\u6240\u4ee5\u5728\u5b66\u4e60\u3002\u4f46\u662f\u5173\u4e8e\u6ce8\u518c\u84dd\u56fe\u7684\u64cd\u4f5c\u6211\u6709\u70b9\u4e0d\u7406\u89e3\uff0c\u5982\u4e0b\uff1a</p>\n<p>\u9879\u76ee\u7ed3\u6784\uff08\u90e8\u5206\uff09</p>\n<pre><code>--app\n  --auth\n     __init__.py\n     views.py\n--run.py\n</code></pre>\n<p>\u7136\u540e\u6211\u770b\u5230<code><a href=\"http://auth.__init__.py\" rel=\"nofollow\">auth.__init__.py</a></code>\u8fd9\u6837\u6ce8\u518c\u84dd\u56fe</p>\n<pre><code>from flask import Blueprint\n\nauth = Blueprint('auth', __name__)\n\nfrom . import views\n</code></pre>\n<p>\u800c\u5728<code><a href=\"http://auth.views.py\" rel=\"nofollow\">auth.views.py</a></code>\u4e2d\u53c8\u5f15\u7528\u4e86 auth</p>\n<pre><code>from . import auth\n\n@auth.route('/unconfirmed')\ndef unconfirmed():\n    if current_user.is_anonymous or current_user.confirmed:\n        return redirect(url_for('main.index'))\n    return render_template('auth/unconfirmed.html')\n</code></pre>\n<p>\u6211\u7684\u7406\u89e3\u662f\u8fd9\u4e24\u4e2a\u6587\u4ef6\u91cc\u9762\u5728\u5faa\u73af\u8c03\u7528 auth \u8fd9\u4e2a\u84dd\u56fe\uff0c\u8fd9\u6837\u505a\u771f\u7684\u53ef\u4ee5\u5417\uff08\u5f53\u7136\u8fd0\u884c\u6ca1\u95ee\u9898\uff0c\u6211\u95ee\u7684\u53ef\u4ee5\u662f\u8fd9\u6837\u7684\u5f15\u7528\u65b9\u5f0f\u662f\u5426\u5408\u7406\uff1f\uff09</p>\n<p>\u8bf4\u8bf4\u6211\u7684\u505a\u6cd5\uff0c\u6211\u5728 views \u91cc\u9762\u4e0d\u4f1a\u5f15\u7528 auth\uff0c\u800c\u662f\u8fd9\u662f\u4e00\u4e2a\u51fd\u6570\uff0c\u4f20\u5165 auth\uff0c\u7136\u540e<code><a href=\"http://__init__.py\" rel=\"nofollow\">__init__.py</a></code>\u4e2d\u5f15\u5165\u8fd9\u4e2a\u51fd\u6570\u6765\u6ce8\u518c\u84dd\u56fe</p>\n<pre><code>#__init__.py\nfrom flask import Blueprint\nfrom .views import init_blueprint\n\nbp = Blueprint('main', __name__)\n\n\ndef init_app(app):\n    init_blueprint(bp)\n    app.register_blueprint(bp)\n\n#views.py\nfrom flask import jsonify, current_app\n\n\ndef index():\n    return ''\n\n\ndef init_blueprint(bp):\n    bp.add_url_rule('/', 'home', index)\n\n</code></pre>\n<p>\u6211\u8fd9\u6837\u505a\u4e3b\u8981\u662f\u907f\u514d\u5faa\u73af\u5f15\u5165\uff0c\u6c42\u89e3\u91ca\u4e0a\u9762\u7684\u90a3\u4e2a\u4ee3\u7801\u7b97\u4e0d\u6563\u5faa\u73af\u5bfc\u5165\uff1f\u8fd9 2 \u4e2a\u65b9\u5f0f\u6700\u5927\u7684\u533a\u522b\u5728\u4e8e\u7b2c\u4e00\u79cd\u53ef\u4ee5\u4f7f\u7528\u88c5\u9970\u5668\uff0c\u7b2c\u4e8c\u79cd\u53ea\u80fd\u4f7f\u7528 add_url_rule \u53bb\u6ce8\u518c\u8def\u7531</p>\n<p>\u9879\u76ee\u6e90\u7801\uff1a <a href=\"https://github.com/miguelgrinberg/flasky/blob/master/app/auth/views.py\" rel=\"nofollow\">https://github.com/miguelgrinberg/flasky/blob/master/app/auth/views.py</a></p>\n", 
      "date_published": "2019-03-22T03:46:48+00:00", 
      "title": "\u5173\u4e8e flask \u5faa\u73af\u5bfc\u5165\u7684\u95ee\u9898\uff1f\u6c42\u89e3\u91ca\uff0c\u8fd9\u4e2a\u7b97\u4e0d\u7b97\u5faa\u73af\u5bfc\u5165\uff1f", 
      "id": "https://www.v2ex.com/t/547346"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/saulshao", 
        "name": "saulshao", 
        "avatar": "https://cdn.v2ex.com/gravatar/2944bca4a43261481f5dc2c31e64bf2c?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/544352", 
      "title": "Flask \u4e2d Blueprint \u5bf9\u5e94\u7684 templates \u6587\u4ef6\u5939\u4f4d\u7f6e", 
      "id": "https://www.v2ex.com/t/544352", 
      "date_published": "2019-03-13T16:15:13+00:00", 
      "content_html": "<p>\u6211\u4e86\u89e3\u7ec4\u7ec7\u4e00\u4e2a flask \u9879\u76ee\u7684\u65f6\u5019\uff0cBlueprint \u662f\u6bd4\u8f83\u5408\u9002\u7684\u65b9\u6cd5\u3002<br>\n\u6587\u4ef6\u5939\u7684\u4e00\u79cd\u7ed3\u6784\u5927\u6982\u5982\u4e0b\uff1a<br>\nApproot/<br>\n-------BP1/<br>\n-----------<strong>init</strong>.py<br>\n-----------<a href=\"http://models.py\" rel=\"nofollow\">models.py</a><br>\n-----------<a href=\"http://routes.py\" rel=\"nofollow\">routes.py</a><br>\n-----------templates/<br>\n--------------------BP1TPL1.html<br>\n--------------------BP1TPL2.html<br>\n-------BP2/<br>\n-----------<strong>init</strong>.py<br>\n-----------<a href=\"http://models.py\" rel=\"nofollow\">models.py</a><br>\n-----------<a href=\"http://routes.py\" rel=\"nofollow\">routes.py</a><br>\n-----------templates/<br>\n--------------------BP2TPL1.html<br>\n--------------------BP2TPL2.html<br>\n\u53e6\u5916\u4e00\u79cd\u7ed3\u6784\u5982\u4e0b:<br>\nApproot/<br>\n-------BP1/<br>\n-----------<strong>init</strong>.py<br>\n-----------<a href=\"http://models.py\" rel=\"nofollow\">models.py</a><br>\n-----------<a href=\"http://routes.py\" rel=\"nofollow\">routes.py</a><br>\n-------BP2/<br>\n-----------<strong>init</strong>.py<br>\n-----------<a href=\"http://models.py\" rel=\"nofollow\">models.py</a><br>\n-----------<a href=\"http://routes.py\" rel=\"nofollow\">routes.py</a><br>\n-------templates/<br>\n----------------BP1/<br>\n--------------------BP1TPL1.html<br>\n--------------------BP1TPL2.html<br>\n----------------BP2/<br>\n--------------------BP2TPL1.html<br>\n--------------------BP2TPL2.html<br>\n\u5047\u8bbe Blueprint \u662f\u53ef\u4ee5\u7531\u4e0d\u540c\u7684\u5f00\u53d1\u8005\u5206\u522b\u5f00\u53d1\uff0c\u6700\u540e\u518d\u6ce8\u518c\u5230\u6574\u4e2a\u7cfb\u7edf\u4e2d\uff0c\u90a3\u4e48\u6211\u89c9\u5f97\u7b2c\u4e00\u79cd\u6587\u4ef6\u5939\u7ed3\u6784\u66f4\u5408\u7406\u3002\u7406\u7531\u662f\u6211\u5982\u679c\u9700\u8981\u65b0\u589e\u4e00\u4e2a blueprint,\u76f4\u63a5\u590d\u5236\u6574\u4e2a\u5b50\u6587\u4ef6\u5939\u8fc7\u6765\uff0c\u7136\u540e\u6ce8\u518c\u5c31\u884c\u4e86\u3002\u5982\u679c\u662f\u7b2c\u4e8c\u79cd\uff0c\u8fd8\u8981\u8003\u8651 templates \u6587\u4ef6\u5939\u7684\u4f4d\u7f6e\u4e4b\u7c7b\u7684\u3002<br>\n\u6211\u60f3\u8bf7\u6559\u4e00\u4e0b\u6709\u5b9e\u9645\u7ecf\u9a8c\u7684\u5f00\u53d1\u8005(\u5728\u4e0b\u6ca1\u6709)\uff0c\u5404\u4f4d\u503e\u5411\u4e8e\u54ea\u79cd\u6587\u4ef6\u5939\u7ed3\u6784\uff1f\u4e3a\u4ec0\u4e48\uff1f<br>\n\u5b9e\u9645\u4e0a\u4e0d\u53ea\u662f Template,\u8fd8\u6709 assests \u6587\u4ef6\u5939\u7b49\u7b49</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/baichen99", 
        "name": "baichen99", 
        "avatar": "https://cdn.v2ex.com/gravatar/a823a2b14cc3aaeefb2e5e65231ab5c5?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/538224", 
      "date_modified": "2019-02-24T11:44:59+00:00", 
      "content_html": "<p>\u7528 flask \u505a\u4e86\u4e00\u4e2a\u8bba\u575b</p>\n<p>github \u5730\u5740: <a href=\"https://github.com/baichen99/WeSHU\" rel=\"nofollow\">https://github.com/baichen99/WeSHU</a></p>\n<p>demo \u5730\u5740: http://39.108.119.41/</p>\n<p>flask \u53ea\u5b66\u4e86\u4e00\u4e2a\u591a\u6708, \u524d\u7aef\u57fa\u672c\u4e0d\u4f1a, \u80af\u5b9a\u662f\u5b58\u5728\u5f88\u591a\u95ee\u9898\u7684, \u5e0c\u671b\u5927\u5bb6\u80fd\u63d0\u70b9\u5efa\u8bae</p>\n", 
      "date_published": "2019-02-24T11:44:30+00:00", 
      "title": "\u7528 flask \u505a\u4e86\u4e00\u4e2a\u8bba\u575b", 
      "id": "https://www.v2ex.com/t/538224"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/feihuxiongdi", 
        "name": "feihuxiongdi", 
        "avatar": "https://cdn.v2ex.com/gravatar/f70ec18f382dbcd74adaa1f85a83f158?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/524601", 
      "title": "Flask \u8bf7\u6c42\u5934\u683c\u5f0f\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/524601", 
      "date_published": "2019-01-07T05:40:14+00:00", 
      "content_html": "<p>\u4f7f\u7528\u5982\u4e0b\u4ee3\u7801\u83b7\u53d6\u8bf7\u6c42\u5934\u4e2d\u7684\u6570\u636e\uff0c\u62ff\u4e0d\u5230\u503c\uff08\u5ba2\u6237\u7aef\u4e5f\u4f7f\u7528<code>access_token</code>\uff09</p>\n<pre><code>access_token=request.header.get_all(\"access_token\")\n</code></pre>\n<p>\u4f7f\u7528\u5982\u4e0b\u4ee3\u7801\u83b7\u53d6\u8bf7\u6c42\u5934\u4e2d\u7684\u6570\u636e\uff0c\u53ef\u4ee5\u62ff\u5230\u503c\uff08\u5ba2\u6237\u7aef\u4e5f\u4f7f\u7528<code>access-token</code>\uff09</p>\n<pre><code>access_token=request.header.get_all(\"access-token\")\n</code></pre>\n<p>\u5728 <strong>Servlet</strong> \u548c <strong>.net Core</strong> \u4e2d\u90fd\u53ef\u4ee5\u4f7f\u7528\u4e0b\u5212\u7ebf\u683c\u5f0f\u7684\u8bf7\u6c42\u5934\u540d\u79f0\uff0c\u4e3a\u4ec0\u4e48 <strong>Flask</strong> \u4e0d\u53ef\u4ee5\uff0c\u662f\u9700\u8981\u989d\u5916\u914d\u7f6e\u5417\uff1f</p>\n<p><strong>\u8bf7\u95ee\u8fd9\u662f\u4e3a\u4ec0\u4e48\uff1f</strong></p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/JerryV2", 
        "name": "JerryV2", 
        "avatar": "https://cdn.v2ex.com/gravatar/4530b574056cba06c3701d3d1055ad5d?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/524454", 
      "date_modified": "2019-01-06T14:19:47+00:00", 
      "content_html": "<p>\u5982\u9898\uff0c\u76ee\u7684\u662f\u901a\u8fc7 Flask \u83b7\u53d6 Word \u6587\u4ef6\u5185\u5bb9\uff0c\u683c\u5f0f\u53ef\u80fd\u662f .doc \u6216\u8005 .docx</p>\n<p>\u5728 Flask \u5185\u901a\u8fc7 win32com \u8c03\u7528 Word \u5c31\u4f1a\u5931\u8d25\uff0c\u4e0d\u901a\u8fc7 Flask \u5c31\u80fd\u6b63\u5e38\u8c03\u7528\u3002</p>\n<p>\u5e94\u8be5\u662f\u6743\u9650\u7684\u539f\u56e0\u5427\uff1f \u5e94\u8be5\u600e\u4e48\u529e\uff1f</p>\n<p>\u7b2c\u4e00\u6b21\u7528 Flask\uff0c\u8bf7\u5927\u795e\u8f7b\u62cd~</p>\n", 
      "date_published": "2019-01-06T14:19:25+00:00", 
      "title": "Flask \u901a\u8fc7 win32com \u8c03\u7528 Word \u5931\u8d25\uff0c\u6c42\u52a9", 
      "id": "https://www.v2ex.com/t/524454"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/sprinkle", 
        "name": "sprinkle", 
        "avatar": "https://cdn.v2ex.com/gravatar/1cf081891a5003f576a1a0bf9390552a?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/514011", 
      "title": "\u76f8\u5bf9\u5bfc\u5165\u62a5\u9519 ValueError: Attempted relative import in non-package", 
      "id": "https://www.v2ex.com/t/514011", 
      "date_published": "2018-12-03T15:16:51+00:00", 
      "content_html": "<p>\u5728\u6a21\u578b\u4e2d\u4f7f\u7528 from . import db, login_manager \u8fd9\u79cd\u76f8\u5bf9\u5bfc\u5165\uff0cflask \u8fd0\u884c\u62a5\u9519\nValueError: Attempted relative import in non-package\n\u540e\u6765\u5168\u6539\u7528\u7edd\u5bf9\u5bfc\u5165\u4e86\u3002\u60f3\u8bf7\u95ee\u4e0b\u4ec0\u4e48\u539f\u56e0</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/sprinkle", 
        "name": "sprinkle", 
        "avatar": "https://cdn.v2ex.com/gravatar/1cf081891a5003f576a1a0bf9390552a?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/513257", 
      "date_modified": "2018-12-01T01:50:19+00:00", 
      "content_html": "<p>model \u4e2d\u81ea\u5b9a\u4e49\u4e86 AnonymousUser \u7c7b\uff1a</p>\n<p>class MyAnonymousUser(AnonymousUserMixin):</p>\n<pre><code>def can(self, permissions):\n\n    return False\n\ndef is_administrator(self):\n\n    return False\n</code></pre>\n<p>login_manager.anonymous_user = MyAnonymousUser</p>\n<p>\u5728\u89c6\u56fe\u51fd\u6570\u4e2d\u4f7f\u7528\u4e86 can \u65b9\u6cd5\uff1a</p>\n<p>@main.route('/', methods=['GET', 'POST'])</p>\n<p>def index():</p>\n<pre><code>form = PostForm()\n\nif current_user.can(Permission.WRITE_ARTICLES) and form.validate_on_submit():\n\n    post = Post(body=form.body.data,\n\n                author=current_user._get_current_object())\n</code></pre>\n<p>\u7ed3\u679c\u8fd0\u884c\u51fa\u73b0'AnonymousUserMixin' object has no attribute 'can'\u7684\u9519\u8bef\uff0c\u8bf7\u95ee\u4e0b\u95ee\u9898\u51fa\u5728\u54ea\u91cc\uff1f\u767b\u5f55\u7528\u6237\u80fd\u591f\u6b63\u5e38\u8c03\u7528\u89d2\u8272\u9a8c\u8bc1\u65b9\u6cd5\u3002</p>\n", 
      "date_published": "2018-12-01T01:48:17+00:00", 
      "title": "flask \u533f\u540d\u7528\u6237\u81ea\u5b9a\u4e49\u7c7b AnonymousUser \u65e0\u6cd5\u8c03\u7528", 
      "id": "https://www.v2ex.com/t/513257"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/duzhonglin", 
        "name": "duzhonglin", 
        "avatar": "https://cdn.v2ex.com/avatar/a5d8/4a66/358081_large.png?m=1540435670"
      }, 
      "url": "https://www.v2ex.com/t/509799", 
      "date_modified": "2018-11-20T14:40:52+00:00", 
      "content_html": "<a target=\"_blank\" href=\"http://__init__.py\" rel=\"nofollow\">__init__.py</a> \u6587\u4ef6<br /># -*- coding = utf-8 -*-<br /><br />import os<br />from flask import Flask<br /><br /><br />def create_app(test_config=None):<br />    app = Flask(__name__, instance_relative_config=True)<br />    app.config.from_mapping(<br />        SECRET_KEY='dev',<br />        DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite')<br />    )<br /><br />    if test_config is None:<br />        app.config.from_pyfile('<a target=\"_blank\" href=\"http://config.py\" rel=\"nofollow\">config.py</a>', silent=True)<br />    else:<br />        app.config.from_mapping(test_config)<br /><br />    try:<br />        os.makedirs(app.instance_path)<br />    except OSError:<br />        pass<br />    <br />    @<a target=\"_blank\" href=\"/member/app\" rel=\"nofollow\">app</a>.route('/hello')<br />    def hello():<br />        return 'Hello, World!'<br />    return app<br />    <br />    from . import db<br />    db.init_app(app)<br />    return app<br /><br /><a target=\"_blank\" href=\"http://db.py\" rel=\"nofollow\">db.py</a> \u6587\u4ef6<br /><br /># -*- coding=utf-8 -*-<br /><br />import sqlite3<br />import click<br />from flask import current_app, g<br />from flask.cli import with_appcontext<br /><br /><br />def get_db():<br />    if 'db' not in g:<br />        g.db = sqlite3.connect(<br />            current_app.config['DATABASE'],<br />            detect_types=sqlite3.PARSE_DECLTYPES<br />        )<br />        g.db.row_factory = sqlite3.Row<br />    return g.db<br /><br /><br />def init_db():<br />    db = get_db()<br />    with current_app.open_resource('schema.sql') as f:<br />        db.executescript(f.read().decode('utf8'))<br /><br /><br />@<a target=\"_blank\" href=\"/member/click\" rel=\"nofollow\">click</a>.command('init-db')<br />@<a target=\"_blank\" href=\"/member/with_appcontext\" rel=\"nofollow\">with_appcontext</a><br />def init_db_command():<br />    init_db()<br />    click.echo('Initialized the database.')<br /><br /><br />def close_db(e=None):<br />    db = g.pop('db', None)<br />    if db is not None:<br />        db.close()<br /><br />def init_app(app):<br />    app.teardown_appcontext(close_db)<br />    app.cli.add_command(init_db_command)<br /><br />\u76ee\u5f55\u7ed3\u6784\uff1a<br />flaskr/<br />       <a target=\"_blank\" href=\"http://__init__.py\" rel=\"nofollow\">__init__.py</a><br />       <a target=\"_blank\" href=\"http://db.py\" rel=\"nofollow\">db.py</a><br />       schema.sql<br /><br />FLASK_APP, FLASK_ENV \u90fd\u5df2\u7ecf\u8bbe\u7f6e\uff0cflask run \u8fd0\u884c\u662f\u6b63\u5e38\u7684\uff0c\u65e0\u62a5\u9519\u3002\u6267\u884c flask init-db \u62a5\u9519\u63d0\u793a\u627e\u4e0d\u5230\u8fd9\u4e2a\u547d\u4ee4\uff1aError: No such command \"init-db\". \u8bf7\u95ee\u5404\u4f4d\u5927\u795e\u662f\u4ec0\u4e48\u539f\u56e0\u554a\uff0c\u6211\u7f51\u4e0a\u7684\u65b9\u6cd5\u90fd\u8bd5\u4e86\u89e3\u51b3\u4e0d\u5462\uff1f", 
      "date_published": "2018-11-20T14:35:04+00:00", 
      "title": "flask \u5b98\u7f51\u6559\u7a0b\u6267\u884c flask init-db \u62a5\u9519", 
      "id": "https://www.v2ex.com/t/509799"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/yezhiye", 
        "name": "yezhiye", 
        "avatar": "https://cdn.v2ex.com/gravatar/38f16a4f9cb0267a669ffeb8906dea03?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/508965", 
      "title": "\u817e\u8baf\u4e91 uwsgi \u4f7f\u7528 daemonize \u53c2\u6570\u5f88\u5bb9\u6613\u5954\u6e83", 
      "id": "https://www.v2ex.com/t/508965", 
      "date_published": "2018-11-18T08:04:06+00:00", 
      "content_html": "<p>\u4e3b\u673a\u662f\u817e\u8baf\u4e91\u4e4b\u524d\u6d3b\u52a8\u4e0a\u7684\u6210\u90fd\u7684\u8f66\uff0c1 \u6838 1G\uff0c\u4e25\u683c\u6309\u7167 <a href=\"https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-16-04\" rel=\"nofollow\">https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-16-04</a> \u90e8\u7f72 \uff08\u8ddf\u8fd9\u7bc7\u5e16\u5b50\u5dee\u4e0d\u591a\uff1a <a href=\"https://www.v2ex.com/t/386228\" rel=\"nofollow\">https://www.v2ex.com/t/386228</a> \uff09\uff0c\u80fd\u6b63\u5e38\u4f7f\u7528\u3002\u60f3\u67e5\u770b uwsgi \u65e5\u5fd7\uff0c\u5728 uwsgi.ini \u52a0\u4e0a daemonize \u53c2\u6570\u6253\u65e5\u5fd7\u5230\u672c\u5730\u540e\uff0c\u6bcf\u6b21\u542f\u52a8\u540e 20 \u79d2\u5185 uwsgi \u670d\u52a1\u5c31\u4f1a\u5954\u6e83\uff0c\u60c5\u51b5\u8ddf do \u4e0b\u9762\u7684\u8ddf\u5e16\u5dee\u4e0d\u591a\u3002\u6c42\u6559\u5927\u4f6c\u8fd9\u662f\u54ea\u65b9\u9762\u5f15\u8d77\u7684\u95ee\u9898\u3002\u8ba1\u7b97\u673a\u7231\u597d\u8005\uff0c\u5e0c\u671b\u80fd\u901a\u4fd7\u70b9\uff0c\u8c22\u8c22\uff01</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/ingin", 
        "name": "ingin", 
        "avatar": "https://cdn.v2ex.com/avatar/02a0/fbc7/298785_large.png?m=1658196736"
      }, 
      "url": "https://www.v2ex.com/t/508439", 
      "title": "\u5728 flask \u4e2d redis \u8ba2\u9605\u6570\u636e\u6301\u4e45\u5316\u5230 mysql \u7684\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/508439", 
      "date_published": "2018-11-16T03:17:57+00:00", 
      "content_html": "<p>\u73b0\u5728\u6709\u4e00\u4e2a flask \u9879\u76ee\uff0c\u5199\u4e86\u4e00\u4e2a\u4e0b\u4efb\u52a1\u7684\u63a5\u53e3\uff0c\u4e0b\u5b8c\u4efb\u52a1\u9700\u8981\u8c03\u7528\u7b2c\u4e09\u65b9\u63a5\u53e3\u53bb\u505a\u4e00\u4e2a\u8bca\u65ad\u670d\u52a1\uff0c\u8bca\u65ad\u5b8c\u6bd5\u540e\u4f1a\u628a\u7ed3\u679c\u63a8\u9001\u5230 redis \u4e0a\uff0c\u6211\u9700\u8981\u8ba2\u9605 redis \u7684 channel \u6765\u76d1\u63a7\u6570\u636e\uff0c\u6240\u4ee5\u6211\u5199\u4e86\u4e00\u4e2a\u5de5\u5177\u65b9\u6cd5\u6765\u76d1\u63a7\u8fd9\u4e2a redis \u7684\u6570\u636e\u53d8\u5316\uff0c\u76d1\u63a7\u5230\u6570\u636e\u53d8\u5316\u5c31\u6301\u4e45\u5316\u5230 mysql\uff0c\u53ef\u662f\u4f7f\u7528 gunicorn \u6765\u5f00\u56db\u4e2a\u8fdb\u7a0b\u8dd1 flask \u670d\u52a1\u7684\u65f6\u5019\u4f1a\u540c\u65f6\u5199\u5165 mysql \u56db\u6761\u6570\u636e\uff0c\u603b\u4e0d\u80fd\u4e3a\u4e86\u76d1\u63a7 redis \u6570\u636e\u5c31\u53ea\u80fd\u4f7f\u7528\u4e00\u4e2a\u8fdb\u7a0b\u6765\u8dd1\u670d\u52a1\u5427\u3002</p>\n"
    }
  ]
}