Django FileBrowser 400错误 [英] Django FileBrowser 400 Error

查看:265
本文介绍了Django FileBrowser 400错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试访问/ admin / filebrowser / browse /页时,我收到了400错误。我按照 https://django-filebrowser.readthedocs.org遵循说明/en/3.5.2/quickstart.html ,并将我的网址和已安装的应用配置正确。

I'm getting a 400 error when trying to access the /admin/filebrowser/browse/ page. I followed the instructions as per https://django-filebrowser.readthedocs.org/en/3.5.2/quickstart.html and have my URLs and installed apps configured correctly.

我不太确定媒体settings.py;

What I'm not too sure about are the media paths in settings.py;

FILEBROWSER_DIRECTORY = os.path.join(BASE_DIR, '/ogencat/MEDIA/uploads')

FILEBROWSER_MEDIA_ROOT = os.path.join(BASE_DIR, '/ogencat/MEDIA')

FILEBROWSER_MEDIA_URL = '/MEDIA/'

我的工作区中有文件夹称为MEDIA,称为上传文件夹。

I have folder in my workspace called MEDIA and a folder within called uploads.

在设置这些路径方面,文档我想要做的是什么 - 我没有看到 getattr(设置,FILEBROWSER_MEDIA_ROOT,settings.MEDIA_ROOT)之前的语法,所以我刚刚添加了路径,我已经为其余的settings.py

I wasn't too sure about what the docs wanted me to do in terms of setting these paths - I hadn't seen the getattr(settings, "FILEBROWSER_MEDIA_ROOT", settings.MEDIA_ROOT) syntax before so I just added the paths as I have done for the rest of settings.py

ks!

推荐答案


  1. 您需要添加尾随斜杠

  2. 目录必须在访问之前存在

这篇关于Django FileBrowser 400错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆