Flask and wsgi, 出现导入报错ImportError: 信息是 cannot import name ap,flaskimporterror,Flask and ws
Flask and wsgi, 出现导入报错ImportError: 信息是 cannot import name ap,flaskimporterror,Flask and ws
Flask and wsgi, 出现导入报错ImportError: 信息是 cannot import name app
为什么会没有导入应用呢?
大家好,做了一个flask的小应用,配置在digital ocean上,按照digital ocean的配置说明配置后链接描述,访问站点时报500错误。看了下apache的日志,错误原因如下,还请帮忙看看。
日志报错:
[Thu Jan 01 01:35:21 2015] [error] [client 112.64.71.131] Traceback (most recent call last):[Thu Jan 01 01:35:21 2015] [error] [client 112.64.71.131] File "/var/www/qianshan/qianshan.wsgi", line 7, in <module>[Thu Jan 01 01:35:21 2015] [error] [client 112.64.71.131] from qianshan import app as application[Thu Jan 01 01:35:21 2015] [error] [client 112.64.71.131] ImportError: cannot import name app
项目结构:
.├── qianshan│ ├── config.ini│ ├── __init__.py│ ├── static│ ├── templates│ └── venv└── qianshan.wsgi
虚拟主机配置
<VirtualHost *:80> ServerName qianshan.co ServerAdmin spark@qianshan.co WSGIScriptAlias / /var/www/qianshan/qianshan.wsgi <Directory /var/www/qianshan/qianshan/> Order allow,deny Allow from all </Directory> Alias /static /var/www/qianshan/qianshan/static <Directory /var/www/qianshan/qianshan/static/> Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined</VirtualHost>
wsgi
#!/usr/bin/pythonimport sysimport logginglogging.basicConfig(stream=sys.stderr)sys.path.insert(0,"/var/www/qianshan/")from qianshan import app as applicationapplication.secret_key = 'Add your secret key'
init.py file
# Filename: __init__.py# encoding: utf-8import ConfigParserimport codecsfrom flask import Flaskfrom flask import render_templateapp = Flask(__name__)@app.route('/')def index(): block_list = getBlockList() website_dict = getWebsiteDict() return render_template('index.html', block_list=block_list, website_dict=website_dict)......if __name__ == '__main__':app.run()
编橙之家文章,
相关内容
- 拍拍贷会采用Python吗,这样的网站需要什么技术,拍拍
- Tornado加上sqlalchemy在SAE上出现错误,tornadosqlalchemy,Torn
- pytesser怎么样识别彩色图片,,linux上装了一天终于
- python db.session.commit()的时候出现FlushError错误,,python d
- 七牛下载链接出现{"error":"download token auth failed"
- 相同硬件不同编程语言,它们的区别是什么呢?,硬件
- python里面为什么系统的时区是东八,但是存数据还是存
- django1.8 出现NoReverseMatch错误怎么解决?,,django1.8 出现
- django读取日志并写入db数据库中,怎么样用页面展示出
- python3 类型Type str doesn't support the buffer API?,python3buffe
评论关闭