문제

I'm trying to put my first flask powered site on my digital ocean server and have followed there tutorial yet I'm getting a syntax error in my apache error log and I am unsure why.

My wsgi file

#!/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

Error Log

[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

I just don't know what to do as I have viewed others and mine seems the exact same.

도움이 되었습니까?

해결책

You are missing a closing parenthesis on this line:

execfile(activate_this, dict(__file__=activate_this)

Notice how you have 2 opening parenthesis, but only 1 closing.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top