Django无法在数字海洋Ubuntu 18.04上提供静态服务

时间:2019-07-28 09:34:09

标签: django nginx server digital-ocean django-staticfiles

再次运行收集静态文件,它起作用了!

遵循的部署指南:https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04#checking-for-the-gunicorn-socket-file

我刚刚成功上传并在数字海洋上运行了我的项目。它是根据youtube上的coreyMS教程使用最新版本的django 2.1.7进行生产前开发的。本教程已将它与ubuntu 18.04一起部署在数字海洋飞沫上。

我不能让它提供任何静态文件。

我的项目的结构是:newsite / myforum /在这里是manage.py 在newsite / myforum / myforum /中是settings.py 我有3个应用程序用户,论坛和商店,它们都位于newsite / myforum目录的文件夹中。

根据coreyms教程的django最新版本的静态文件夹应该位于我的主应用程序中,因此位于forum / static / forum中。 所以总路径是newsite / myforum / forum / static / forum

我的设置是:

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
STATIC_URL = '/static/'

在nginx配置中,我指定了路径home / myuser / mydir / myenv / newsite / myforum 也许我应该尝试:主页/ myuser / mydir / myenv / newsite / myforum / forum / static / forum 或者只是:home / myuser / mydir / myenv / newsite / myforum / forum / static /

或者我应该更改django设置,然后运行collectstatic命令。

花了我很长时间才能完成部署工作,我不想运行一个愚蠢的命令并破坏它。

非常感谢您的帮助!!!!!!!!!!

0 个答案:

没有答案
相关问题