A starter example for project using Bottle/MySQL database.
Stack Information
- bottle 0.12
- MySQL latest
The prerequisites of this starter example,
Clone this repository,
$ cd bottle-mysqlBuild docker image,
$ docker compose buildRun docker compose services,
$ docker compose upThen visit http://127.0.0.1:8080
After docker compose is up, then you can enter the MySQL container. Open another terminal session and run
$ docker compose exec db bashwhich would let you enter the bash shell of MySQL container. Then run mysql command to connect the database.
$ mysql --host localhost --port 3306 --user root --passwordThe password is 123456 here. Afte enter the MySQL container, then you can run mysql queries, e.g.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| devdb |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)To exit the mysql command line, type exit.
pre-commit is introduced into this project for code quality control.
Create your local virtual environment, then please run
pip install -r requirements-dev.txtto install packages for dev, including pre-commit.
To customize pre-commit config, please update the .pre-commit.config.yaml file.
If you are using any IDE, then configure the IDE to use this virtual environment.