在BeaverDam中使用django发布打开静态文件

问题描述 投票:1回答:1

我正在尝试使用视频注释工具BeaverDam离线注释静态视频。https://github.com/antingshen/BeaverDam

我在目录'/ home / arl / BeaverDam / annotator / static / videos'中有一个视频文件0.mp4'

然后我将STATICFILES_DIRS包含在安装文件中:https://github.com/antingshen/BeaverDam/blob/master/beaverdam/settings.py

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "annotator/static/")
STATICFILES_DIRS = ("/home/arl/BeaverDam/annotator/static/videos", )

我无法查看URL中的静态文件夹。尝试过类似的选项本地主机:5000 / annotator / static /本地主机:5000 / annotator / static / videos

任何帮助将不胜感激

##

1]在设置文件(https://github.com/antingshen/BeaverDam/blob/master/beaverdam/settings.py)中,“调试”设置为false

# Use different key for production
SECRET_KEY = '8pje5%pxibt2c=&j_c+ly5v@x)$r77%h-x3%jluq-@)4^75)ak'
DEBUG = False

2]在设置文件(https://github.com/antingshen/BeaverDam/blob/master/beaverdam/settings.py)中,我包括了STATICFILES_DIRS。这就是我现在设置的方式:

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "annotator/static/")
STATICFILES_DIRS = ['/home/arl/BeaverDam/annotator/static/videos', ]

3)修改了video.html(https://github.com/antingshen/BeaverDam/blob/master/annotator/templates/video.html)以包括静态文件夹

{% extends "base.html" %}

{% load static %}
{% block content %}
{% static '0.mp4' %} 
{% endblock content %}

{% block head %}
<link rel="stylesheet" type="text/css" href="/static/app.css"/>
….

4)python3 manage.py collectstatic给了我:1个静态文件复制到'/ home / arl / BeaverDam / annotator / static',其中90个未修改。

5)http://localhost:5000/static/annotator/0.mp4给我“在此服务器上找不到所请求的URL /static/annotator/0.mp4。”

django
1个回答
1
投票
© www.soinside.com 2019 - 2024. All rights reserved.