Heim  >  Fragen und Antworten  >  Hauptteil

flask - 很简单的几句python代码,为什么直接Process finished with exit code 2呢?

直接运行就这样了

前几天还可以的..不知道怎么突然就不行了.

求熟手帮忙看看原因.

大家讲道理大家讲道理2743 Tage vor986

Antworte allen(3)Ich werde antworten

  • 高洛峰

    高洛峰2017-04-17 14:40:37

    flask-script 这个插件的用法是在命令行里输入

    python hello.py runserver
    

    使用 pycharmrun 功能,只是执行 python hello.py, 并没有添加 runserver 参数。因此脚本没有参数就执行完毕了。

    解决方案就是在 在 run选项的下拉箭头,选择 edit configure选项,然后在 script parameters里添加即可

    Antwort
    0
  • 怪我咯

    怪我咯2017-04-17 14:40:37

    运行的时候没有加参数

    Antwort
    0
  • 怪我咯

    怪我咯2017-04-17 14:40:37

    提示里已经有了

    usage: hello.py [-?] {runserver, shell} ...
    

    试下

    python.exe D:\...\hello.py runserver
    

    或者将最后一行代码改成

    app.run()
    

    Antwort
    0
  • StornierenAntwort