django之创建第12个项目-加载图片
百度云盘:django之创建第12个项目-加载图片
1、setting配置
#静态文件相关配置
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/' import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
#os.path.join(BASE_DIR, "static"),
os.path.join(BASE_DIR, "static").replace('\\', '/'),
)
2、设置存放静态文件图片的目录位置
C:\djangoweb\helloworld\blog\static\images\登录按钮1.jpg
3、配置html页面
<!--插入图片-->
<form id="form1" name="form1" method="get" action="http://127.0.0.1:8000/admin/" target="_blank">
<input name="submit" type="image" value="登录入口" src="/static/images/登录按钮1.jpg" />
</form>
django之创建第12个项目-加载图片的更多相关文章
- Android RecyclerView使用 及 滑动时加载图片优化方案
1.控制线程数量 + 数据分页加载2.重写onScrollStateChanged方法 这个我们后面再谈,下面先来看看RecyclerView控件的使用及我们为什么选择使用它 RecyclerView ...
- django之创建第11个项目-页面整合
目的:将如下众多html页面整合到一个index.html页面中. 百度云盘:django之创建第11个项目-页面整合 用下面的方式实现: <!DOCTYPE html> <head ...
- django之创建第10-1个项目-图片上传并记录上传时间
1.百度云盘:django之创建第10-1个项目-图片上传并记录上传时间 2.主要修改的配置文件有3个,forms.views和models3个文件以及html 3.forms.py文件修改 #cod ...
- django之创建第8-3个项目-数据库数据提取之高级操作
1.配置test2.html <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...
- django之创建第8-1个项目-数据库之增删改查/数据库数据显示在html页面
1.为test.DB数据库预先创建下面数据 1 张三 16 2015-01-02 12 李四 17 2015-01-04 13 王五 14 ...
- django之创建第7-4个项目-配置views文件实现url传值
即:怎么实现url?name=xiaodeng&age=28等类似传值处理 1.配置views文件 # Create your views here. #coding:utf-8 from d ...
- django之创建第7个项目-url配置
1.配置urls.py from django.conf.urls import patterns, include, url #Uncomment the next two lines to ena ...
- django之创建第6个项目-过滤器
1.views.PY # Create your views here. #coding:utf-8 from django.http import HttpResponse import datet ...
- django之创建第5个项目-条件语句
1.index <!DOCTYPE html> <html lang="en"> <head> <meta charset="U ...
随机推荐
- HTTP Error 502.5 – Process Failure
https://www.cnblogs.com/lookerblue/p/7101641.html http://www.cnblogs.com/lookerblue/p/7102040.html h ...
- linux和windows时间同步问题(UTC&localtime)
Linux使用 UTC,但是windows默认使用localtime.解决的办法如下(重启后生效). 进入windows使用regedit写入DWORD值(设置成十六进制"1"): ...
- Go语言之进阶篇操作redis
1.windows安装redis 软件包下载地址: https://github.com/MicrosoftArchive/redis/releases 1.1.安装--->下一步---> ...
- Solr4.4入门,介绍Solr的安装、IK分词器的配置及高亮查询结果(转)
一.Windows下安装solr-4.4.0 1. 下载solr.4.4 2. 下载绿色版tomcat6.0.18 3. 解压下载的solr到d:\study\solr,将dist目录下的sol ...
- iOS开发-UIButton浅谈
UIButton算是最基本的一个控件了,不过有的时候用法挺多关于UIButton文字的位置,字体大小,字体的颜色 1.设置UIButton字体大小,尤其注意不要使用直接调用setFont: [self ...
- qt文字改变方向
QPainter painter(this); QFont font("Courier", 24); painter.setFont ...
- Android -- Dialog动画
window_in.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android ...
- Documentation/PCI/pci-iov-howto.txt
Chinese translated version of Documentation/PCI/pci-iov-howto.txt If you have any comment or update ...
- Dicom格式文件解析器[转]
Dicom格式文件解析器 Dicom全称是医学数字图像与通讯,这里讲的暂不涉及通讯那方面的问题 只讲*.dcm 也就是diocm格式文件的读取,读取本身是没啥难度的 无非就是字节码数据流处理.只不 ...
- Ubuntu 12.04.1 mysql从5.5升级到5.6
Ubuntu 12.04.1 mysql从5.5升级到5.6 1 2 3 4 5 apt-cache search mysql-server sudo apt-add-repository ppa: ...