mod_wsgi (pid=10144, process='', application='localhost|'): Failed to parse WSGI scr

Posted learndu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mod_wsgi (pid=10144, process='', application='localhost|'): Failed to parse WSGI scr相关的知识,希望对你有一定的参考价值。

[Wed Jan 31 19:01:18.044138 2018] [wsgi:error] [pid 10144:tid 804] [client ::1:54225] mod_wsgi (pid=10144, process=‘‘, application=‘localhost|‘): Failed to parse WSGI script file ‘C:/Apache24/hello/HelloWorld/HelloWorld/wsgi.py‘.
[Wed Jan 31 19:01:18.045138 2018] [wsgi:error] [pid 10144:tid 804] [client ::1:54225] mod_wsgi (pid=10144): Exception occurred processing WSGI script ‘C:/Apache24/hello/HelloWorld/HelloWorld/wsgi.py‘.
[Wed Jan 31 19:01:18.045138 2018] [wsgi:error] [pid 10144:tid 804] [client ::1:54225] File "C:/Apache24/hello/HelloWorld/HelloWorld/wsgi.py", line 19
[Wed Jan 31 19:01:18.045138 2018] [wsgi:error] [pid 10144:tid 804] [client ::1:54225] SyntaxError: Non-ASCII character ‘\\xe8‘ in file C:/Apache24/hello/HelloWorld/HelloWorld/wsgi.py on line 19, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

 

是因为 wsgi.py中没有添加 # -*- coding: utf-8 -*-  

添加后wsgi.py的内容如下,就ok了

# -*- coding: utf-8 -*-
"""
WSGI config for HelloWorld project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""

import os

import sys

#Calculate the path based on the location of the WSGI script.
apache_configuration= os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)

sys.path.append(project) #这个路径是项目主目录,如F:/mysite,一定要加上

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "HelloWorld.settings")

application = get_wsgi_application()










以上是关于mod_wsgi (pid=10144, process='', application='localhost|'): Failed to parse WSGI scr的主要内容,如果未能解决你的问题,请参考以下文章

深度剖析Linux进程的内部机制:一探/proc/pid的奥秘

mod_wsgi 无法连接 WSGI 守护进程

UVA10144 ZOJ2044 Expression

了解 Linux /proc/pid/maps 或 /proc/self/maps

认识/proc/[pid]/

认识/proc/[pid]/