Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate static site using frozen flask
- Loading branch information
Showing
4 changed files
with
49 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 4 * * *" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Install packages | ||
run: python -m pip install . | ||
|
||
- name: Build site | ||
run: DATA_DIR=./data python freeze.py | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./pyworking_cz/build/ | ||
cname: pyworking.cz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from flask_frozen import Freezer | ||
from pyworking_cz.web import app | ||
from pyworking_cz.model import load_events | ||
|
||
freezer = Freezer(app) | ||
|
||
|
||
@freezer.register_generator | ||
def workshop_detail(): | ||
events = load_events() | ||
return [("views.workshop_detail", {"slug": event["slug"]}) for event in events] | ||
|
||
if __name__ == '__main__': | ||
freezer.freeze() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters