Python Django 1.8模板文件中的图像显示问题
我试着喜欢Django,并将其用于定制高流量项目。为此,我正在和django一起做探戈教程。我一直坚持图像显示步骤。这是我的代码: settings.py文件:Python Django 1.8模板文件中的图像显示问题,python,django,image,django-views,Python,Django,Image,Django Views,我试着喜欢Django,并将其用于定制高流量项目。为此,我正在和django一起做探戈教程。我一直坚持图像显示步骤。这是我的代码: settings.py文件: # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_D
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "/static/images"),
STATIC_URL,
]
index.html文件:
<!DOCTYPE html>
<html>
<head>
<title>Rango</title>
</head>
<body>
<h1>Rango says...</h1>
{% load staticfiles %}
<img src="{% static "images/lwd.jpg" %}" alt="Picture of Rango" /><br />
hello world! <strong>{{ boldmessage }}</strong><br />
<a href="/rango/about/">About</a><br />
</body>
</html>
兰戈
兰戈说。。。
{%load staticfiles%}
你好,世界{{boldmessage}
下面是结果的截图:
我不知道我做错了什么,我甚至查阅了文档 请看
非常感谢,是的,这解决了我的问题。这里的解决方案:#静态文件(CSS、JavaScript、图像)#静态文件URL='/Static/'STATICFILES_DIRS=[os.path.join(BASE_DIR,“/Static/Images”),'G:/Users/chris/tango_with_django_project/Static',]
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
'/var/www/static/', # this should be file path not URL
]