老师,我在看4-8节视频时,在centos上运行你讲的程序不开启debug模式可以巡行,一开启就报错,这是怎么回事?

来源:4-8 数据库ORM

blood_kyo

2019-05-06

写回答

3回答

blood_kyo

提问者

2019-05-06

#我的源代码是Hello.py,就是4-3节视频讲的那个程序

# -*- coding: utf-8 -*-
from flask import Flask

app = Flask(__name__)

@app.route('/')
def hello_world():
   return 'Hello World'

if __name__ =='__main__':
   app.run(host='0.0.0.0',debug=True)



0
0

blood_kyo

提问者

2019-05-06

C(imooc) [root@localhost Test]# python Hello.py

 * Serving Flask app "Hello" (lazy loading)

 * Environment: production

   WARNING: Do not use the development server in a production environment.

   Use a production WSGI server instead.

 * Debug mode: on

 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

 * Restarting with stat

Traceback (most recent call last):

  File "Hello.py", line 11, in <module>

    app.run(host='0.0.0.0',debug=True)

  File "/root/imooc/lib/python3.5/site-packages/flask/app.py", line 943, in run

    run_simple(host, port, self, **options)

  File "/root/imooc/lib/python3.5/site-packages/werkzeug/serving.py", line 988, in run_simple

    run_with_reloader(inner, extra_files, reloader_interval, reloader_type)

  File "/root/imooc/lib/python3.5/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader

    sys.exit(reloader.restart_with_reloader())

  File "/root/imooc/lib/python3.5/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader

    exit_code = subprocess.call(args, env=new_environ, close_fds=False)

  File "/usr/local/python3/lib/python3.5/subprocess.py", line 560, in call

    with Popen(*popenargs, **kwargs) as p:

  File "/usr/local/python3/lib/python3.5/subprocess.py", line 950, in __init__

    restore_signals, start_new_session)

  File "/usr/local/python3/lib/python3.5/subprocess.py", line 1540, in _execute_child

    raise child_exception_type(errno_num, err_msg)

OSError: [Errno 8] Exec format error


0
2
blood_kyo
谢谢老师,我的问题解决了
2019-05-07
共2条回复

编程浪子

2019-05-06

你好

请贴出报错信息

0
3
blood_kyo
老师,你常用的联系方式是什么,我想私信你,我打算用这个项目做本科的毕业设计,所以时间比较紧,麻烦你及时解答我的问题,谢谢啦,我这个bug都已经调一天了,各种百度,实在是不知道怎么回事
2019-05-06
共3条回复

Python Flask构建微信小程序订餐系统(可用于毕设)

微信小程序 + Python Flask 打造订餐系统全栈应用,可用于毕设。

1709 学习 · 1889 问题

查看课程