flask: 静态文件的访问

一,创建目录

image

二,代码

css

.item {background:#0000ff;padding-top:15px;margin-top:13px;margin-left:15px;width:672px;
    position:absolute;left:-12px;border-top:1px solid silver;border-left:0px;border-right:0px;
    border-bottom:0px;line-height:24px;}

页面

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/item.css') }}" type="text/css">
</head>
<body>
<form method=POST enctype=multipart/form-data action="{{ url_for('photo.photo_uploaded') }}">
    <input type=file name=photo>
    <input type=submit>
</form>

<img src="{{ url_for('static', filename='images/egt.jpg') }}" style="width:200px;" />

<div class="item" style="width:200px;height:200px;"></div>
</body>
</html>

三,测试效果:

image 

posted @ 2025-11-11 11:02  刘宏缔的架构森林  阅读(16)  评论(0)    收藏  举报