简体   繁体   English

Django heroku上传文件

[英]Django heroku uploading files

[Errno 30] Read-only file system: '/static_in_env' [Errno 30]只读文件系统:'/ static_in_env'

I am new to heroku, when I push my django application on heroku, I can't upload files, yet it is working properly in local computer! 我是heroku的新手,当我在heroku上推送django应用程序时,我无法上传文件,但它在本地计算机上正常运行!

Here is the error: 这是错误:

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

Unfortunately, Heroku does not host your application Media files. 不幸的是,Heroku没有托管您的应用程序媒体文件。 So what you need is to pick up a third party service like AWS S3 to store data in the cloud. 因此,您需要使用第三方服务(例如AWS S3)将数据存储在云中。

Below is the official guide of how you can deal with Django applications media files on Heroku. 以下是有关如何在Heroku中处理Django应用程序媒体文件的官方指南。

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

Reminder: Django "media" files are files that have been uploaded by web site users, that then need to be served from your site. 提醒:Django“媒体”文件是由网站用户上传的文件,然后需要从您的网站提供。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM