浏览代码

enabling last updated date

main
Simon Bowie 5 天前
父节点
当前提交
696495745a
共有 4 个文件被更改,包括 20 次插入6 次删除
  1. +5
    -5
      README.md
  2. +3
    -1
      web/app/models.py
  3. +6
    -0
      web/app/templates/book.html
  4. +6
    -0
      web/app/templates/resource.html

+ 5
- 5
README.md 查看文件



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.



+ 3
- 1
web/app/models.py 查看文件

# 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):

+ 6
- 0
web/app/templates/book.html 查看文件

</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>

+ 6
- 0
web/app/templates/resource.html 查看文件

{% 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 %}

正在加载...
取消
保存