mod_wsgi (pid=10144, process='', application='localhost|'): Failed to parse WSGI script file 'C:/Apa...

[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()

转载于:https://www.cnblogs.com/GenDu/p/8393952.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值