Fluorescent pyrene-based polymer organic frameworks (POFs) PY-POFs were designed and synthesized by a facile solvothermal route for glucose detection, employing melamine, aromatic dialdehydes, 1-pyrenecarboxaldehyde, and phenylboronic acid as building blocks. The structure and photophysical properties of as-prepared POFs were systematically characterized via Fourier-transform infrared spectroscopy, X-ray photoelectron spectroscopy, scanning electron microscopy, transmission electron microscopy, N2 adsorption isotherms and fluorescence spectroscopy. The PY-POFs possessed intrinsic microporosity derived from extensively interlinked aminal structures, boasting specific surface areas reaching 192 m²/g, pore volumes extending to 0.8079 cm³/g, pore diameters of up to 17 nm, and an average particle dimension of ∼ 31 nm. In addition, the PY-POFs exhibited a dual-wavelength emission of pyrene excimer (λem = 472 nm) and monomer (λem = 382, 400, and 422 nm). When exposed to glucose, the former emission decreased while the latter increased, corresponding to the conformational transition of pyrene molecule from excimer to monomer. The non-enzymatic ratiometric fluorescent sensor displayed remarkable sensitivity towards glucose within 10−200 μM range, with a limit of detection (LOD) of 5.6 µM. Moreover, the glucose detection ability of PY-POFs was also in vivo demonstrated within zebrafish. Application of this sensor to real samples such as human saliva and DMEM biological matrix presented satisfactory results and good reproducibility. These results indicate that the fluorescent glucose sensor PY-POFs have broader prospects for utilization within biological studies.