Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python wsgi文件上的语法错误(使用apache设置烧瓶应用程序)_Python_Flask_Syntax Error_Mod Wsgi - Fatal编程技术网

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

Python wsgi文件上的语法错误(使用apache设置烧瓶应用程序),python,flask,syntax-error,mod-wsgi,Python,Flask,Syntax Error,Mod Wsgi,我正在尝试将我的第一个flask-powered站点放在我的digital ocean服务器上,并遵循了该教程,但我在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 loggi

我正在尝试将我的第一个flask-powered站点放在我的digital ocean服务器上,并遵循了该教程,但我在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

我只是不知道该怎么办,因为我已经看过其他人了,而我的似乎完全一样。

这一行缺少一个右括号:

execfile(activate_this, dict(__file__=activate_this)

请注意,您有两个左括号,但只有一个右括号。

谢谢您的帮助,现在我的错误日志中出现了一个导入错误,在mysite导入应用程序的第10行上显示为application ImportError:没有名为mysite的模块,我不知道为什么?@RetroCoNoR:如果这个答案帮助您解决了原始问题(不正确的括号)请把它标为答案。看来你还有一个问题。如果你不能解决这个问题,请提出一个全新的问题,而不是继续在这里的评论中提问。