Flask and wsgi, ImportError: cannot import name app

大家好,做了一个flask的小应用,配置在digitalocean上,按照digitalocean的配置说明配置后链接描述,访问站点时报500错误。看了下apache的日志,错误原因如下,还请帮忙看看。
日志报错:
[ThuJan0101:35:212015][error][client112.64.71.131]Traceback(mostrecentcalllast):
[ThuJan0101:35:212015][error][client112.64.71.131]File"/var/www/qianshan/qianshan.wsgi",line7,in
[ThuJan0101:35:212015][error][client112.64.71.131]fromqianshanimportappasapplication
[ThuJan0101:35:212015][error][client112.64.71.131]ImportError:cannotimportnameapp
项目结构:
.
├──qianshan
│├──config.ini
│├──__init__.py
│├──static
│├──templates
│└──venv
└──qianshan.wsgi
虚拟主机配置
ServerNameqianshan.co
ServerAdminspark@qianshan.co
WSGIScriptAlias//var/www/qianshan/qianshan.wsgi
Orderallow,deny
Allowfromall
Alias/static/var/www/qianshan/qianshan/static
Orderallow,deny
Allowfromall
ErrorLog${APACHE_LOG_DIR}/error.log
LogLevelwarn
CustomLog${APACHE_LOG_DIR}/access.logcombined
wsgi
#!/usr/bin/python
importsys
importlogging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/qianshan/")
fromqianshanimportappasapplication
application.secret_key='Addyoursecretkey'
init.pyfile
#Filename:__init__.py
#encoding:utf-8
importConfigParser
importcodecs
fromflaskimportFlask
fromflaskimportrender_template
app=Flask(__name__)
@app.route('/')
defindex():
block_list=getBlockList()
website_dict=getWebsiteDict()
returnrender_template('index.html',block_list=block_list,website_dict=website_dict)
...
...
if__name__=='__main__':
app.run()
长风秋雁
浏览 449回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript