An open API service indexing awesome lists of open source software.

https://github.com/franceme/franceme.github.io

My Personal Website
https://github.com/franceme/franceme.github.io

flask frozen python research research-and-development website website-template

Last synced: 5 months ago
JSON representation

My Personal Website

Awesome Lists containing this project

README

          

# Base Website

Helpful Items

1. The index.html page is the main and only webpage
2. The setup.py provides any variables and methods used within the html webpage
1. index.html uses Jinja internally to process the website
3. Think of the process similar to compilation
1. Index is the raw source code
2. Python (setup.py) compiles the index.html webpage into the usable format
3. Python (setup.py) returns the useable index.html, with all the information sent in as a live dynamic website

However GitHub Actions and GitHub Pages only uses Static Pages.
The Python package [Frozen-Flask](https://github.com/Frozen-Flask/Frozen-Flask) is able to freeze the dynamic website to static webpages.
Essentially the usable index.html file produced by Python (setup.py) gets frozen to a static website.
Methods and variables are transferred from python to html listed below.

> Methods
```python
def get_base():
.
.
.
return flask.render_template_string(f"""TA DA""")

app.jinja_env.filters['get_base'] = get_base
```
> Variables
```python
@app.route('/index.html')
def index():
.
.
.
return render_template_string(get_file(page),mimetype="text/html",variable_one="variable_one")
```
There are a few cavietes that need to be handled:
1. Redirects cannot be handled using regular flask methods since the dynamic page gets translated to a static webpage. However a static html that redirects is a working redirect that I use. The code is listed below.
```html





window.location.href = "{url}"

Page Redirection


If you are not redirected automatically, follow this link to example.

```

2. The website is compiled, no dynamic handling or webpage redirecting.