首页 > 其他 > 详细

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

时间:2016-01-04 06:34:14      阅读:374      评论:0      收藏:0      [点我收藏+]

由于在测试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。。

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

原文:http://www.cnblogs.com/piperck/p/5097594.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!