• 解决从pip上下载的最新flask版本不能运行flaskr和最新特性的问题


    由于在测试flask的单元测试。所以准备弄个环境,查询官方文档发现flask源码里面有一个example文件夹里面有个flaskr应用 可供测试

    看了一下readme文档,大致是这样

                             / Flaskr /
    
                     a minimal blog application
    
    
        ~ What is Flaskr?
    
          A sqlite powered thumble blog application
    
        ~ How do I use it?
    
          1. edit the configuration in the flaskr.py file or
             export an FLASKR_SETTINGS environment variable
             pointing to a configuration file.
    
          2. initialize the database with this command:
    
             flask --app=flaskr initdb
    
          3. now you can run flaskr:
    
             flask --app=flaskr run
    
             the application will greet you on
             http://localhost:5000/
    
        ~ Is it tested?
    
          You betcha.  Run the `test_flaskr.py` file to see
          the tests pass.

    很明显就是一些介绍,然后告诉你怎么用。

    到这里你可能会直接尝试执行 

    flask --app=flaskr initdb

    然而 可能并没有卵用,你的cli会告诉你 flask command not found.  这个坑我去issue搜了一下,果然最近还有人问

    由于这个是最新的特性出现在flask最新版本0.11.dev0 所以直接使用pip install flask得到的最新版本是无法运行的 环境变量也是没有被修改的

    所以执行这个命令,是没有办法得到想要的效果。issue上面有人给出了解决方案 大致是直接从代码安装最新版本 我尝试了一下 用pip 直接安装最新代码是可以解决这个问题的。

    pip install https://github.com/mitsuhiko/flask/tarball/master 

     这句话直接用pip install 拉了github上面的最新主master 稳定版。然后再尝试 就可以了。

    最后用

    export

      

    。。。再次被打脸。不要尝试使用百度解决此类问题。。这辈子都搜不到。。

    看文档 看英文。。搜问题用google。。 amend。。

  • 相关阅读:
    ext2文件系统
    可变宏
    SPI—读写串行 FLASH
    使用命令
    FreeRtos——任务删除,改变任务优先级
    FreeRTOSConfig 配置文件详解
    FreeRtos——空闲任务与空闲任务钩子函数
    Elasticsearch从入门到精通-Elasticsearch是什么
    kibana从入门到精通-Kibana安装
    kibana从入门到精通-Kibana配置详解
  • 原文地址:https://www.cnblogs.com/piperck/p/5097594.html
Copyright © 2020-2023  润新知