> For the complete documentation index, see [llms.txt](https://stb11816.gitbook.io/python_note/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stb11816.gitbook.io/python_note/web-framework.md).

# Web Development

## DOM

把一份 HTML 文件內的各個標籤，包括文字、圖片等等都定義成物件，而這些物件最終會形成一個樹狀結構

<https://ithelp.ithome.com.tw/articles/10202689>

## Chrome控制檯黃色警告： \[Deprecation] Synchronous XMLHttpRequest

解決方法：ajax改同步請求為非同步請求

<https://www.itread01.com/content/1544461921.html>

## 網頁架構

### 1. web伺服器 (web server)

主要為接收使用者網路請求並回傳結果，ex. Nginx/apache

### 2. WSGI

全名為 Web伺服器閘道介面（Python Web Server Gateway Interface)，為 Web server 和 Python 程式溝通的橋樑

ex. gunicorn/uWSGI/flask, django，都有附帶wsgi功能

### 3. web框架

django/flask，主要我們撰寫的程式

當一個瀏覽者來逛你的 Python 網路服務時，網路請求會經過 web server 到 WSGI App server 再到你的 Python 程式，再從 Python 程式回傳資料沿著原路回到瀏覽器

<https://hahow.in/courses/58001218da04300700fdee95/discussions/5dc6790931ab60002067dd6b>

<https://blog.csdn.net/lihao21/article/details/52304119>

## SSL

如何使用 OpenSSL 建立開發測試用途的自簽憑證 (Self-Signed Certificate)\
<https://blog.miniasp.com/post/2019/02/25/Creating-Self-signed-Certificate-using-OpenSSL>

Flask 配置 HTTPS 網站 SSL 安全認證\
<https://medium.com/@charming_rust_oyster_221/flask-%E9%85%8D%E7%BD%AE-https-%E7%B6%B2%E7%AB%99-ssl-%E5%AE%89%E5%85%A8%E8%AA%8D%E8%AD%89-36dfeb609fa8>

產生自簽憑證，並加到flask當中

目前測試結果確實可用ssl瀏覽，可是chrome會跳出警示訊息

\===

(整理) Flask + Nginx 詳細OpenSSL設定方法\
<https://medium.com/@lufor129/%E6%95%B4%E7%90%86-flask-nginx-%E8%A9%B3%E7%B4%B0openssl%E8%A8%AD%E5%AE%9A%E6%96%B9%E6%B3%95-f619a41ac0d1>

有附上免費申請網域的地方： <https://nctu.me/>

\===

其他免費認證憑證

架網站為什麼需要 SSL 憑證？免費的 SSL 憑證教學！\
<https://www.woodowlab.com/free-ssl-certificate/>
