【问题标题】:Django heroku uploading filesDjango heroku 上传文件
【发布时间】:2017-01-18 09:50:15
【问题描述】:

[Errno 30] 只读文件系统:'/static_in_env'

我是heroku的新手,当我在heroku上推送我的django应用程序时,我无法上传文件,但它在本地计算机上正常工作!

这是错误:

OSError at /admin/products/product/add/
[Errno 30] Read-only file system: '/static_in_env'
Request Method: POST
Django Version: 1.8
Exception Type: OSError
Exception Value:    
[Errno 30] Read-only file system: '/static_in_env'
Exception Location: /app/.heroku/python/lib/python2.7/os.py in makedirs, line 157
Python Executable:  /app/.heroku/python/bin/python
Python Version: 2.7.12
Python Path:    
['/app',
 '/app/.heroku/python/bin',
 '/app',
 '/app/.heroku/python/lib/python27.zip',
 '/app/.heroku/python/lib/python2.7',
 '/app/.heroku/python/lib/python2.7/plat-linux2',
 '/app/.heroku/python/lib/python2.7/lib-tk',
 '/app/.heroku/python/lib/python2.7/lib-old',
 '/app/.heroku/python/lib/python2.7/lib-dynload',
 '/app/.heroku/python/lib/python2.7/site-packages',
 '/app/.heroku/python/lib/python2.7/site-packages/setuptools-25.2.0-py2.7.egg',
 '/app/.heroku/python/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg']
Server time:    Sat, 10 Sep 2016 10:14:54 +0000

【问题讨论】:

  • 具体说明您的错误并学会自己阅读异常。这是一个解决问题的网站,无法为您阅读和理解某些内容。

标签: python html css django heroku


【解决方案1】:

很遗憾,Heroku 不托管您的应用程序媒体文件。因此,您需要选择 AWS S3 之类的第三方服务来将数据存储在云中。

以下是有关如何在 Heroku 上处理 Django 应用程序媒体文件的官方指南。

https://devcenter.heroku.com/articles/s3-upload-python

提醒:Django“媒体”文件是网站用户上传的文件,然后需要从您的网站提供。

【讨论】:

    猜你喜欢
    • 2012-03-11
    • 2018-12-15
    • 2017-09-06
    • 2017-09-11
    • 1970-01-01
    • 1970-01-01
    • 2014-02-04
    • 2011-04-11
    • 1970-01-01
    相关资源
    最近更新 更多