Python--Nginx+uWSGI+Flask (三)日志找错误

经验总结

日志寻找错误源

  • 设置uWSGI.ini的运行日志
  • 设置Nginx的运行日志

错误一:
  先开uWSGI.ini 然后开 Nginx,504错误,日了狗了!
打开uWSGI的运行日志,有如下错误!

Traceback (most recent call last):
  File "/home/two/main.py", line 1, in <module>
    from flask import Flask
ImportError: No module named flask

瞬间明白!我特么还没有进入虚拟空间virtualenv,就开uWSGI了!要知道外部环境没有Python运行环境的。
workon 虚拟环境名 再运行,搞定!

错误二
  打开uWSGI.ini 和重加载 Nginx后了,内部服务器错误!!!又特么日了狗!看uWSGI运行日志!!!

*** Operational MODE: preforking+threaded ***
added /home/two/ to pythonpath.
  File "/home/two/main.py", line 9
    def home()
             ^
SyntaxError: invalid syntax
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 29008)
spawned uWSGI worker 1 (pid: 29009, cores: 2)
spawned uWSGI worker 2 (pid: 29010, cores: 2)
spawned uWSGI worker 3 (pid: 29011, cores: 2)
spawned uWSGI worker 4 (pid: 29012, cores: 2)
  File "/home/two/main.py", line 9
    def home()
             ^
SyntaxError: invalid syntax

靠!原来是Python文件有语法错误,应该是函数后面忘记打冒号了!!!
vim修改过后,搞定!

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页