favicon 파비콘 등록하는방법
본문 바로가기

Network&etc/vscode&package.json

favicon 파비콘 등록하는방법

파비콘 생성

(png파일로 여러사이즈준비할것, 16*16, 48*48, 64*64px등)

redketchup.io/icon-editor

 

Icon Editor | Edit Icon Files Online - RedKetchup

View and edit Windows icons (ICO files) directly from the browser. Create icons in 8-bit, 24-bit, or 32-bit color depth. Add text to icons using any Google Fonts.

redketchup.io

준비한 이미지들을 add Image-import

 

파비콘 적용방법 1

<link rel="shortcut icon" href="./image/favicon.ico" type="image/x-icon">

매번 경로를 불러와야해서 메모리가 차지됨. 매 html페이지마다 넣어야해서 매우 비효율적인방법

 

파비콘 적용방법 2

from flask import render_template, request, session, redirect, url_for, send_file, current_app

	@visitor.route('/favicon.ico')
    def favicon():
        favicon_path = current_app.root_path + '/static/img/favicon.ico'
        if os.path.exists(favicon_path):
            return send_file(favicon_path)
        else:
            return 404

절대경로 루트 /에서 바로 호출되게끔 서버단에서 조정해주면됨

참고로 위 예제는 파이썬프레임워크인 flask에서 사용한 코드임

반응형

'Network&etc > vscode&package.json' 카테고리의 다른 글

notepad 셋팅  (0) 2021.05.10
Visual studio code 단축키, 확장기능(extentions)  (0) 2021.05.03
cmd 용어정리  (0) 2021.04.22
Redmine textism  (0) 2021.03.24
파이참 페이지추가방법  (0) 2020.08.11