【问题标题】:How to keep Bottle routes handling images from gridfs in mod_wsgi?如何让 Bottle 路由在 mod_wsgi 中处理来自 gridfs 的图像?
【发布时间】:2014-11-27 06:53:57
【问题描述】:

期望的行为

允许 Bottle 路由处理以下格式的图像请求:

<img src="/gridfs/img/my_image.jpg">

在服务器上,这是由 Bottle 路由处理并按预期返回图像:

@route('/gridfs/img/<filename>')
def server_gridfs_img(filename):
    # get the image
    # return it

当前行为

然而,在本地环境中,设置了mod_wsgi,我得到了错误:

内部服务器错误
服务器遇到内部错误或配置错误,无法完成您的请求。
请通过 webmaster@localhost 联系服务器管理员,告知他们此错误发生的时间,以及您在此错误之前执行的操作。 服务器错误日志中可能会提供有关此错误的更多信息。
Apache/2.4.7 (Ubuntu) 服务器在 localhost 端口 80

我的尝试

这是我本地的mod_wsgi 配置:

WSGIPythonHome /var/www/html/ENV
WSGIPythonPath /var/www/html:/var/www/html/ENV/lib/python2.7/site-packages:/var/www/html/wsgi
<VirtualHost *:80>

# for all content in static folder - css, js, img, fonts
Alias /static/ /var/www/html/wsgi/static/

# for rockmongo administration
Alias /rockmongo /var/www/html/rockmongo

<Directory /var/www/html/rockmongo>
Order deny,allow
Allow from all
</Directory>

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    WSGIScriptAlias / /var/www/html/wsgi/application

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

这是我的/var/www/html/wsgi/application

from mybottleapp import application

目录

问题

我的应用程序中的其余路线似乎得到了尊重。

Bottle 似乎并没有处理像/gridfs/img/my_image.jpg 这样的图像请求。

我怎样才能做到这一点?

更新

查看了 Apache 错误日志并看到了这个:

CorruptGridFile: no chunk #1

我现在正在排除故障...

【问题讨论】:

    标签: python-2.7 mod-wsgi bottle


    【解决方案1】:

    我在这里发布了上面提到的更新情况的解决方案:

    How to mongodump from OpenShift and mongorestore locally on MongoDB 2.4.9?

    数据损坏是由使用 RockMongo 导出和导入引起的 - 显然有时这种方法和更大的数据集可能会出现问题。

    【讨论】:

      猜你喜欢
      • 2013-05-26
      • 1970-01-01
      • 1970-01-01
      • 2014-04-08
      • 2017-06-23
      • 1970-01-01
      • 2019-05-22
      • 2016-04-27
      • 2020-03-18
      相关资源
      最近更新 更多