wsgi文件的语法错误(使用apache设置烧瓶应用程序)

时间:2014-01-20 16:46:29

标签: python flask syntax-error mod-wsgi

我正在尝试将我的第一个烧瓶供电网站放在我的数字海洋服务器上,并且已经按照那里的教程我在apache错误日志中遇到语法错误,我不确定为什么。

我的wsgi文件

#!/usr/bin/python
activate_this = '/var/www/mysite/venv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this)

import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/mysite/")

from mysite import app as application

错误记录

[Mon Jan 20 16:22:51 2014] [error] [client 86.153.31.236] SyntaxError: invalid syntax
[Mon Jan 20 16:26:16 2014] [error] [client 86.153.31.236] mod_wsgi (pid=24338,     process='', application='mysite.co.uk|'): Failed to parse WSGI script file '/var/www    /mysite/flaskr.wsgi'.
[Mon Jan 20 16:26:16 2014] [error] [client 86.153.31.236] mod_wsgi (pid=24338):     Exception occurred processing WSGI script '/var/www/mysite/flaskr.wsgi'.
[Mon Jan 20 16:26:16 2014] [error] [client 86.153.31.236]   File "/var/www/mysite    /flaskr.wsgi", line 6
[Mon Jan 20 16:26:16 2014] [error] [client 86.153.31.236]     import sys
[Mon Jan 20 16:26:16 2014] [error] [client 86.153.31.236]          ^
[Mon Jan 20 16:26:16 2014] [error] [client 86.153.31.236] SyntaxError: invalid syntax

我只是不知道该做什么,因为我已经看过其他人,而我的看法完全相同。

1 个答案:

答案 0 :(得分:3)

您在此行中缺少右括号:

execfile(activate_this, dict(__file__=activate_this)

注意你有2个左括号,但只有1个结束。

相关问题