https://github.com/lbaf23/flask_demo
https://github.com/lbaf23/flask_demo
flask mysql restful-api
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lbaf23/flask_demo
- Owner: lbaf23
- Created: 2023-03-03T13:11:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-05T05:54:55.000Z (over 3 years ago)
- Last Synced: 2025-09-23T03:40:00.771Z (10 months ago)
- Topics: flask, mysql, restful-api
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flask Demo
- [Flask](https://flask.net.cn/) Restful API
- with crud examples
- MySQL [Flask-SQLAlchemy — Flask-SQLAlchemy Documentation (3.0.x) (palletsprojects.com)](https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/)
## dev
- install
```bash
pip install -r requirements.txt
```
- set config
```bash
cp config.py config_dev.py
```
> set mysql user and password in config_dev.py
>
> create database `demo`
- run
```bash
python app.py
```
- generate requirements.txt
```bash
pip install pipreqs
pipreqs ./ --force --encoding='utf-8'
```
## prod
- gunicorn
- gevent
### cmd
- Linux
```bash
gunicorn app:app -c gunicorn.conf.py
```
### docker
```bash
docker build -t flask_demo .
```
- Linux
```bash
docker run --name=flask_demo --network=host -d --rm flask_demo
```
- others
> docker-desktop doesn't support host network
```bash
docker run --name=flask_demo -p 5000:5000 -d --rm flask_demo
```