simple-flask-blog
所属分类:后台框架
开发工具:HTML
文件大小:299KB
下载次数:0
上传日期:2023-02-03 15:16:36
上 传 者:
sh-1993
说明: 使用Python的Flask框架开发简单的博客。我最喜欢的编程语言之一。
(Simple blog develop using Flask framework of Python. One of my favorite programming language.)
文件列表:
app.py (118, 2023-02-03)
app (0, 2023-02-03)
app\__init__.py (248, 2023-02-03)
app\models.py (831, 2023-02-03)
app\routes.py (1175, 2023-02-03)
app\services.py (88, 2023-02-03)
app\static (0, 2023-02-03)
app\static\assets (0, 2023-02-03)
app\static\assets\logo.avif (46534, 2023-02-03)
app\static\assets\logo.webp (37252, 2023-02-03)
app\static\css (0, 2023-02-03)
app\static\css\about.css (102, 2023-02-03)
app\static\css\base.css (39, 2023-02-03)
app\static\css\header.css (357, 2023-02-03)
app\static\css\home.css (53, 2023-02-03)
app\static\css\math.css (22, 2023-02-03)
app\templates (0, 2023-02-03)
app\templates\about.html (2599, 2023-02-03)
app\templates\base.html (1430, 2023-02-03)
app\templates\content.html (2891, 2023-02-03)
app\templates\header.html (1742, 2023-02-03)
app\templates\home.html (3266, 2023-02-03)
app\templates\math.html (445, 2023-02-03)
design (0, 2023-02-03)
design\about.png (179436, 2023-02-03)
design\content.png (18011, 2023-02-03)
design\header.png (7773, 2023-02-03)
design\home.png (22148, 2023-02-03)
dummy_data (0, 2023-02-03)
dummy_data\post.json (1853, 2023-02-03)
requirements.txt (149, 2023-02-03)
tools.py (921, 2023-02-03)
# Cai at
1. Tao moi truong ao
- Chay cau lenh: `python -m venv venv`
- Bat moi truong ao: `venv\Scripts\activate.bat` -> Co chu venv
### Neu a co file `requirements.txt`
2a. Cai at thu vien uoc share
- Chay cau lenh `pip install -r requirements.txt`
### Neu chua co file `requirements.txt`
2b. Cai `Flask` len moi truong ao
- Chay cau lenh: `pip install Flask`
## Giu trang thai moi truong
Trong qua trinh code, va cai thu vien, thu muc `venv` co the len en vai GB. Ta khong the share thu muc nay, chi co the share phien ban cua cac thu vien. e share phien ban, thi dung cau lenh: `pip freeze > requirements.txt`
# Chay project
## Bat bien moi truong
- `venv\Scripts\activate`
## Setup bien moi truong
```
set FLASK_APP=app.py
set FLASK_DEBUG=1
```
## Chay server
Neu co database:
- `python tools.py init_db`
- `python -i` e kiem tra ket qua (import tat ca vao va query thu).
- `flask run`
-> Nhap vao uong link [http://127.0.0.1:5000](http://127.0.0.1:5000) e thuong thuc.
# Giao dien
![Design](https://user-images.githubusercontent.com/110530318/21608***71-df0ad3fa-4a77-4046-adc1-f76f80c2d96e.png)
# database
- User
user_id: int | primary_key
username: string
password: string
name: string
email: string
- Post
post_id: int | primary_key
image_url: string
title: string
intro_content: string
post_date: datetime
content: string
近期下载者:
相关文件:
收藏者: