NameError: name 'hasattr' is not defined - Python3.6, Django1.11, Ubuntu16-17, Apache2.4, mod_wsgi

前端 未结 3 1358
猫巷女王i
猫巷女王i 2021-01-12 10:54

I\'ve set up my Python/Django virtual environment, and mod_wsgi in daemon mode, and am pretty sure (done this before) it\'s \"mostly correct\" except I get the fol

3条回答
  •  一生所求
    2021-01-12 11:06

    This is likely due to code still running in background threads when the Python interpreter is being destroyed on process shutdown. What happens during interpreter destruction is that all modules get wiped out and attribute access of things often returns None as fallback. In this case looks like builtins module was wiped before the PIL object got destroyed and so it couldn't find hasattr.

    Can you confirm this only happens when Apache is being restarted and processes shutdown?

提交回复
热议问题