简体   繁体   English

flask-restful 没有这样的命令

[英]flask-restful no such command

I'm currently building a flask-restful app and i want to create a CLI command, i currently have this: db.py: https://haste.themelvin.nl/osn4sl api.py: https://haste.themelvin.nl/vNaAl4 but when i execute flask init-db in my terminal I get this error: Error: No such command 'init-db'.我目前正在建设一个烧瓶的RESTful应用程序,我想创建一个CLI命令,我现在有这样的:db.py: https://haste.themelvin.nl/osn4sl api.py: HTTPS://haste.themelvin .nl/vNaAl4但是当我在终端中执行flask init-db ,我收到此错误: Error: No such command 'init-db'. does anybody know how i can fix this?有谁知道我该如何解决这个问题?

You should check out the instructions are listed in below:您应该查看下面列出的说明:

  1. Edit the configuration in the your flaskr.py file or export an FLASKR_SETTINGS environment variable pointing to a configuration file.编辑您的flaskr.py文件中的配置或导出指向配置文件的FLASKR_SETTINGS环境变量。

  2. Install the app from the change directory to root of the project directory将应用程序从更改目录安装到项目目录的根目录

    pip install --editable .
  3. Be sure flask to use the correct application确保烧瓶使用正确的应用程序

    export FLASK_APP=flaskr
  4. Initialize the database with command like this:使用如下命令初始化数据库:

     flask initdb
  5. And finally最后

    flask run

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM