Files
books/README

55 lines
3.2 KiB
Plaintext

########################################################### FOR local INSTALL:
# flask -> python web server
# sqlalchemy -> provides db-agnostic python objects of db content (and more)
# flask-sqlachemy combines/wraps this to provide a db.* set of objects based on the 'app' that flask creates
# marshmallow-sqlachemy provides a way to create a 'schema' of your class, then serialize an object to it
# flask-wtf -> 'what the form' allows form consistency/validation based on defining attributes in a class for each form
# flask-bootstrap -> allows me to format that wtf form with boostrap markup - yet to test if it also means I don't need to include it exlicitly in head, etc.
# install needed binaries (maybe I could have done this instead of pip below too -- when I docker this shit, sort it out?)
sudo apt install python3-pip python3-psycopg2 libpq-dev python3-flask
### LEARN: supposedly could use virtualenv instead of pip3 install --user? OR even apt to install direct?
# --user sticks python libs in ~/.local/[bin|lib|share]
pip3 install --user flask sqlalchemy flask-sqlalchemy flask-marshmallow SQLAlchemy-serializer flask-wtf flask-bootstrap marshmallow-sqlalchemy
########################################################### FOR local RUN:
# run a DEV version by:
FLASK_APP=main FLASK_ENV=development flask run --host=192.168.0.2
### to make a new PROD copy..
sudo docker-compose -f /srv/docker/config/docker-compose.yml stop bookdb_web
sudo docker-compose -f /srv/docker/config/docker-compose.yml rm bookdb_web
sudo docker-compose -f /srv/docker/config/docker-compose.yml build bookdb_web
sudo docker-compose -f /srv/docker/config/docker-compose.yml up bookdb_web
########################################################## Remember:
MUST use form.errors when we have a validator that is fancier than not empty (year_published in book and num_books in series SO FAR)
##### make backup / export:
ddp@mara:/srv/docker/container/bookdb_dev$ sudo docker exec -it bookdb_dev bash
root@5eff50ab6cdc:/# pg_dump --user=ddp library > /docker-entrypoint-initdb.d/tables.sql
#### if we want to upgrade postgres, do this extra step
sudo docker-compose -f /srv/docker/config/docker-compose.yml stop bookdb_dev
sudo rm -rf /srv/docker/container/bookdb_dev/data
#tweak docker-compose.yml to upgrade PG...
sudo docker-compose -f /srv/docker/config/docker-compose.yml up -d bookdb_dev
########################################################### TODOS (next 29):
Validation:
TODO-17: view list of possible duplicate books by title
TODO-18: consider which of the 'books maybe not valid' reports make sense still
- can you even have an N/A publisher now for example?
- but the genre one is interesting
TODO-19: icons on wish list, etc.? (not sure I really want them, but if so)
- wishlist: search-dollar OR https://www.flaticon.com/free-icon/wishlist_868517
- save: https://www.flaticon.com/free-icon/sold_463255?term=sold&page=1&position=6&related_item_id=463255
Maybe:
TODO-20: ORM all books load is slow
- should I lazy load all books (ajax the 2nd->last pages in, or not use ORM, and do a quick db.execute()....)
TODO-21: allow a way to add a book as a child of another existing book (opposite of rem_sub_book)