配置模版
- 在tango_with_django_project下新建templates文件夹
- 配置tango_with_django_project/setttings.py
TEMPLATE_PATH = os.path.join(BASE_DIR, 'templates')
TEMPLATE_DIRS = (
TEMPLATE_PATH,
)
- 新建templates/rango
- 新建templates/rango/index.html
- render模版
![render template](https://img-blog.csdn.net/20160413121805343)
配置静态文件夹– getting a static media file onto one of your pages
- 在static文件夹下
mkdir images
- 设置setttings.py
STATIC_PATH = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = (
STATIC_PATH,
)
{% load staticfiles %}
<img src="{% static "images/rango.jpg" %}" alt="Picture of Rango"/>