这里是我的settings.py,
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static', 'static_root')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static', 'static_dirs'),
)
MEDIA_ROOT = os.path.join(BASE_DIR, 'static', 'media')
MEDIA_URL = '/media/'
这是我的base.html
<!DOCTYPE html>
{% load staticfiles %}
<script src="{{ STATIC_URL }}js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript" src = "{% static 'js/docs.min.js' %}" ></script>
请帮助!!
答案 0 :(得分:0)
你需要jquery for bootstrap,还有:
<script src="{{ STATIC_URL }}js/bootstrap.min.js" type="text/javascript"></script>
应该是
<script src="{% static 'js/bootstrap.min.js' %}" type="text/javascript"></script>
或
<script src='/static/js/bootstrap.min.js' type="text/javascript">
如果您在上下文中有STATIC_URL,则还需要添加斜杠“/”,