码迷,mamicode.com
首页 > 移动开发 > 详细

mod_wsgi (pid=10144, process='', application='localhost|'): Failed to parse WSGI script file 'C:/Apache24/hello/HelloWorld/HelloWorld/wsgi.py'.

时间:2018-01-31 22:20:42      阅读:971      评论:0      收藏:0      [点我收藏+]

标签:led   variable   sys.path   orm   ica   sci   cat   路径   inf   

[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 script file 'C:/Apache24/hello/HelloWorld/HelloWorld/wsgi.py'.

标签:led   variable   sys.path   orm   ica   sci   cat   路径   inf   

原文地址:https://www.cnblogs.com/GenDu/p/8393952.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!