| In the command line, navigate to the directory where this repository is stored on your local machine and run: | In the command line, navigate to the directory where this repository is stored on your local machine and run: | ||||
| `docker-compose up -d --build` | |||||
| `docker compose up -d --build` | |||||
| Docker should build the application environment comprising a Python container running Flask and a database container running MariaDB. | Docker should build the application environment comprising a Python container running Flask and a database container running MariaDB. | ||||
| To take down the environment, run: | To take down the environment, run: | ||||
| `docker-compose down` | |||||
| `docker compose down` | |||||
| ### populating the database | ### populating the database | ||||
| To intially create the database and a database user: | To intially create the database and a database user: | ||||
| `docker-compose exec -it db mariadb -u root -p` | |||||
| `docker compose exec -it db mariadb -u root -p` | |||||
| Enter your root password as defined in .env.dev. | Enter your root password as defined in .env.dev. | ||||
| Restart the containers to allow Flask to build the database tables: | Restart the containers to allow Flask to build the database tables: | ||||
| `docker-compose down` | |||||
| `docker-compose up -d --build` | |||||
| `docker compose down` | |||||
| `docker compose up -d --build` | |||||
| You can then use database_functions.sh and an SQL file to populate the database e.g. | You can then use database_functions.sh and an SQL file to populate the database e.g. | ||||
| # all resource types | # all resource types | ||||
| id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy | id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy | ||||
| created = db.Column(db.DateTime, default=datetime.utcnow) | created = db.Column(db.DateTime, default=datetime.utcnow) | ||||
| updated = db.Column(db.DateTime, onupdate=datetime.utcnow) | |||||
| published = db.Column(db.Boolean) | published = db.Column(db.Boolean) | ||||
| type = db.Column(db.Text) | type = db.Column(db.Text) | ||||
| name = db.Column(db.Text) | name = db.Column(db.Text) | ||||
| description = db.Column(db.Text) | description = db.Column(db.Text) | ||||
| videoUrl = db.Column(db.Text) | |||||
| # tools | # tools | ||||
| developer = db.Column(db.Text) | developer = db.Column(db.Text) | ||||
| developerUrl = db.Column(db.Text) | developerUrl = db.Column(db.Text) | ||||
| bookUrl = db.Column(db.Text) | bookUrl = db.Column(db.Text) | ||||
| isbn = db.Column(db.Text) | isbn = db.Column(db.Text) | ||||
| typology = db.Column(db.Text) | typology = db.Column(db.Text) | ||||
| # all | |||||
| videoUrl = db.Column(db.Text) | |||||
| # table for relationships | # table for relationships | ||||
| class Relationship(db.Model): | class Relationship(db.Model): |
| </div> | </div> | ||||
| </div> | </div> | ||||
| {% endif %} | {% endif %} | ||||
| {% if resource['updated'] %} | |||||
| <div class=""> | |||||
| <h3>Entry last updated</h3> | |||||
| {{ resource['updated'].strftime('%Y-%m-%d')|safe }} | |||||
| </div> | |||||
| {% endif %} | |||||
| {% if resource['desc'] %} | {% if resource['desc'] %} | ||||
| <div class="lg:col-span-2"> | <div class="lg:col-span-2"> | ||||
| <h3>Publisher's description</h3> | <h3>Publisher's description</h3> |
| {% endif %} | {% endif %} | ||||
| </div> | </div> | ||||
| {% endif %} | {% endif %} | ||||
| {% if resource['updated'] %} | |||||
| <div class=""> | |||||
| <h3>Entry last updated</h3> | |||||
| {{ resource['updated'].strftime('%Y-%m-%d')|safe }} | |||||
| </div> | |||||
| {% endif %} | |||||
| {% elif resource.type == 'practice' %} | {% elif resource.type == 'practice' %} | ||||
| {{ practice_markdown | safe }} | {{ practice_markdown | safe }} | ||||
| {% endif %} | {% endif %} |