在Heroku上部署Django / Static文件的正确方法

时间:2021-01-31 19:17:07

I am currently working on a Django application, and planning to deploy with Heroku and gunicorn. I've been reading some documentation, and I'm a little confused over proper method to use either nginx or Amazon S3 to support static files and take Django off debug mode.

我目前正在研究Django应用程序,并计划使用Heroku和gunicorn进行部署。我一直在阅读一些文档,我对使用nginx或Amazon S3支持静态文件并使Django关闭调试模式的正确方法感到困惑。

  1. If I use Nginx with gunicorn, are all static files stored on Heroku, and if so, how do I handle user uploaded files given limited storage on Heroku?

    如果我使用Nginx和gunicorn,所有静态文件都存储在Heroku上,如果是这样,我如何处理用户上传的文件,因为Heroku存储空间有限?

  2. If I use S3 to host my static files, does the application still necessitate the use of nginx, or would I still need it for security purposes? What would you recommend?

    如果我使用S3来托管我的静态文件,应用程序是否仍然需要使用nginx,还是出于安全目的还需要它?你会推荐什么?

I've been searching for a tutorial involving Heroku and nginx, but haven't been able to find any so far. Thanks in advance.

我一直在寻找一个涉及Heroku和nginx的教程,但到目前为止还没找到。提前致谢。

1 个解决方案

#1


2  

If you're deploying to Heroku you likely don't need to mess with anything nginx. See this guide on

如果你正在部署到Heroku,你可能不需要弄乱任何nginx。请参阅本指南

See also

也可以看看

#1


2  

If you're deploying to Heroku you likely don't need to mess with anything nginx. See this guide on

如果你正在部署到Heroku,你可能不需要弄乱任何nginx。请参阅本指南

See also

也可以看看