Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

3 lat temu
3 lat temu
3 lat temu
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. One of the key deliverables for Work Package 6 of the COPIM project is "an online resource detailing opportunities for experimental book publishing". We've decided to put this together in the form of an online compendium with details of software, practices, examples, and sensitivities that can be used for experimental publishing.
  2. The Experimental Publishing Compendium will build on this review of tools to present a resource for any researcher, artist, or publisher looking to try experimental publishing. This compendium includes not only software tools that can be used to do experimental publishing but practices of experimental publishing and examples of experimental publications.
  3. ## application structure
  4. The Experimental Publishing Compendium is a Python application using the [Flask](https://flask.palletsprojects.com/en/2.2.x/) framework to render as a website and to provide functions around user authentication and login as well as retrieving data from the underlying database. The Flask framework uses a few HTML template pages to render different pages efficiently based on routes defined in Python files.
  5. The database is a MariaDB SQL database with a basic structure of Resources, Relationships, and Users. Resources are divided into tools, practices, and books and the table contains fields for these various types of resources. Relationships defines the links between resources using the resource ID in the Resource table: these are rendered on the site as connections between, say, a tool and a practice. Users contains the site's users with basic details like email address and hashed password. This simple structure provides flexibility for displaying resources with filters and to illustrate the connections between various resources.
  6. ### RESTful API
  7. The application has a simple RESTful API deployed using [Marshmallow](https://marshmallow.readthedocs.io/en/stable/index.html) to define schemas based on the SQLAlchemy database models. It allows a simple JSON export of users (login required), tools, practices, and books.
  8. The API is relatively open and is available at ./api
  9. ## deployment instructions
  10. ### environment files
  11. To deploy this environment, first copy env.template to a new file, env.dev. Fill in the appropriate environment variables.
  12. ### Docker Compose
  13. In the command line, navigate to the directory where this repository is stored on your local machine and run:
  14. `docker-compose up -d --build`
  15. Docker should build the application environment comprising a Python container running Flask and a database container running MariaDB.
  16. The website should then be available in the browser at 'localhost:5000'.
  17. To take down the environment, run:
  18. `docker-compose down`
  19. ### populating the database
  20. To intially create the database and a database user:
  21. `docker-compose exec -it db mariadb -u root -p`
  22. Enter your root password as defined in .env.dev.
  23. `CREATE DATABASE compendium;`
  24. `CREATE USER 'flask'@'%' IDENTIFIED BY '[PASSWORD]';`
  25. `GRANT CREATE, INSERT, UPDATE, SELECT, DELETE ON compendium.* TO 'flask'@'%';`
  26. Restart the containers to allow Flask to build the database tables:
  27. `docker-compose down`
  28. `docker-compose up -d --build`
  29. You can then use database_functions.sh and an SQL file to populate the database e.g.
  30. `./database_functions -i ./db_imports/compendium_db_20230112.sql`
  31. ## database functions
  32. This repository contains a shell script to perform various database functions including importing a whole database from SQL file, exporting the database in SQL, exporting individual tables as tab-delimited txt file, and importing individual tables from tab-delimited txt file.
  33. Run `./database_functions -h` to see the instructions for this script.
  34. ### legacy database instructions:
  35. The following is no longer required in Flask-SQLAlchemy 3. See https://stackoverflow.com/questions/73968584/flask-sqlalchemy-db-create-all-got-an-unexpected-keyword-argument-app
  36. To build the database tables run:
  37. `docker exec -it python python`
  38. `from app import db, create_app, models`
  39. `db.create_all(app=create_app())`
  40. ## credits
  41. Content in the Experimental Publishing Compendium is © 2022–2023 [COPIM](https://copim.ac.uk) and licensed under a [Creative Commons Attribution 4.0 International License (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/).
  42. Book cover data is from the [Open Library Covers API](https://openlibrary.org/dev/docs/api/covers).
  43. The Experimental Publishing Compendium's source code is available at [https://github.com/COPIM/expub_compendium](https://github.com/COPIM/expub_compendium) and is licensed under the [MIT License](https://github.com/COPIM/expub_compendium/blob/main/LICENSE).
  44. The Experimental Publishing Compendium was developed by [Simon Bowie](https://simonxix.com) and designed by [Joel Galvez](https://www.joelgalvez.com/) and Martina Vanini.