A starter example for project using Bottle/Postgres
Stack Information
- bottle 0.12
- postgres latest
The prerequisites of using the starter example are the following:
Get this starter example,
$ cd bottle-postgresBuild docker image,
$ docker compose buildRun docker compose services,
$ docker compose upThen visit 127.0.0.1:8080
After docker compose is up, then you can enter the Postgres container. Open another terminal session and run
$ docker compose exec db bashwhich would let you enter the bash shell of Postgres container. Then run psql command to connect the database.
$ psql --host localhost --port 5432 --user postgresAfte enter the Postgres container, then you can run postgresql queries, e.g.
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges
-----------+----------+----------+------------+------------+------------+-----------------+-----------------------
postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc |
template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
(3 rows)To exit psql command line, type \q command.
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.
Happy coding!