Decorative image frame

人生如逆旅,我亦是行人

行有不足 | 反求诸己

人生如逆旅,我亦是行人

css中使用vw感悟

避免媒体查询的繁琐,我尝试了使用vw做适配

此方法适用于写H5以及对浏览器兼容性要求不高的项目

说明:1vw 相当于屏幕的1%的宽度, 1vh相当于屏幕的1%的高度, 根据这一特性,我把设计师的设计稿的宽度设置成1000px,高度等比例变化(设置方法:用ps打开设计稿,找到编辑菜单栏中,图像=>图像大小,注意勾选宽度和高度旁边的锁链,这个代表着等比例放大缩小)

阅读全文 >>

js技巧一

时间格式化

1
2
3
4
5
6
7
8
9
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
阅读全文 >>

Django命令

  • 启动开发服务器 python manage.py runserver
  • 运行 python manage.py migrate 来应用数据库迁移
  • 对模型文件修改项进行迁移 python manage.py sqlmigrate [projectname]
  • 运行 python manage.py makemigrations 为模型的改变生成迁移文件
  • 创建管理员账号 python manage.py createsuperuser
阅读全文 >>

Flask 与数据库

  1. 在Linux上安装 MySQL-python,直接在终端输入sudo pip install mysql-pyhton

    1
    2
    3
    4
    5
    6
    如果出现错误::
    raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found

    原因可能是没有安装libmysqlclient-dev
    安装: sudo apt-get install libmysqlclient-dev
  2. 在Linux上安装flask-SQLAlchemy, 在终端输入sudo pip install flask-sqlalchemy

阅读全文 >>