V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
4ever911
V2EX  ›  Python

bootstrap admin theme 配合 flask 的正确打开方式是什么?

  •  
  •   4ever911 · 2018-08-09 10:11:18 +08:00 via iPhone · 1520 次点击
    这是一个创建于 2080 天前的主题,其中的信息可能已经有所发展或是发生改变。
    对 web 不熟,需要做一个简单好看的后台信息展示小工具,找了几个好看的模版,目前我的方式是:

    1. 先在购买的 theme 的基础上搭建一个范例文件,组合出我需要的一些 ui 元素和页面布局

    2. 因为会有很多用不到的 js 和 css,这一步需要一条一条删除然后刷新页面看是否有影响,然后最终保存一个相对简洁的文件。

    3. 拷贝到 flask 中做模版,又需要修改资源路径,js css 等


    4.jinja 替换 ui 元素信息为我要的信息


    赶觉这样操作好浪费时间。



    所以,我的问题是:
    1. 是不是我这种使用 bootstrap admin theme 结合 flask 的方式不对?

    2. 有没有方法针对某一个页面,仅仅只另存为用到加载到的资源。比如随便一个 bootstrap theme 里面就有大量图片和 js font 都用不到,能怎么保存一个精简版?

    听说 react 做 ui 爽,我简单看了下,学习起来要费时间,我目前主要只是要一个好看的 admin 加上一些 ajaxj 动态刷新就足够。
    2 条回复    2018-08-09 10:25:21 +08:00
    hiwljun
        1
    hiwljun  
       2018-08-09 10:19:01 +08:00
    adminlte 了解一下。

    <!-- Tell the browser to be responsive to screen width -->
    <link rel="stylesheet" href="{{ url_for('static', filename='plugins/bootstrap/css/bootstrap.min.css') }}">

    <!-- Font Awesome -->
    <link rel="stylesheet" href="{{ url_for('static', filename='plugins/font-awesome/css/font-awesome.min.css') }}">

    <!-- Ionicons -->
    <link rel="stylesheet" href="{{ url_for('static', filename='plugins/Ionicons/css/ionicons.min.css') }}">

    <!-- Theme style -->
    <link rel="stylesheet" href="{{ url_for('static', filename='css/AdminLTE.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/skin-blue.min.css') }}">

    <!-- jQuery 3 -->
    <script src="{{ url_for('static', filename='plugins/jquery/jquery.min.js') }}"></script>

    <!-- Bootstrap 3.3.7 -->
    <script src="{{ url_for('static', filename='plugins/bootstrap/js/bootstrap.min.js') }}"></script>

    <!-- AdminLTE App -->
    <script src="{{ url_for('static', filename='js/adminlte.min.js') }}"></script>
    scukmh
        2
    scukmh  
       2018-08-09 10:25:21 +08:00
    干嘛搞那么麻烦,nginx static 做一个,api 做一个,不要用 flask 的模板。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2460 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 15:48 · PVG 23:48 · LAX 08:48 · JFK 11:48
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.