-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun.py
38 lines (27 loc) · 902 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Import app & constants
import website
from src import constants
# Import Frozen-Flask, a static site generator
from flask_frozen import Freezer
if constants.ssr == True:
"""
Server Side Rendering is active
This is useful if we need a static version of the site
to deploy in a web server or to Netlify.
Static files will be saved in a new /build directory
"""
@website.ssr.register_generator
def social_redirect():
for social in constants.social_metadata:
yield {'name': social}
if __name__ == '__main__':
# Run the initial Flask app
website.ssr.freeze()
else:
"""
Server Side Rendering is disabled
The app will be executed and run by a Flask server
to be served dynamically.
"""
if __name__ == '__main__':
website.app.run(debug=False, host=constants.host, port=constants.port)