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-postgres
Build docker image,
$ docker compose build
Run docker compose services,
$ docker compose up
Then 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 bash
which would let you enter the bash shell of Postgres container. Then run psql
command to connect the database.
$ psql --host localhost --port 5432 --user postgres
Afte 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.txt
to install packages for dev, including pre-commit
.
To customize pre-commit config, please update the .pre-commit.config.yaml
file.
Happy coding!