|
|
@ -16,16 +16,12 @@ ACCESS_TOKEN = os.getenv('ACCESS_TOKEN') |
|
|
|
client = contentful.Client(SPACE_ID, ACCESS_TOKEN) |
|
|
|
contentful_service = ContentfulService(SPACE_ID, ACCESS_TOKEN) |
|
|
|
|
|
|
|
# Simple in-memory cahce - this is to store information that will be used on all pages, so I don't have to make |
|
|
|
# request's over and over again. |
|
|
|
global festival_general_info_cache |
|
|
|
|
|
|
|
with app.app_context(): |
|
|
|
festival_general_info_cache = contentful_service.get_general_info() |
|
|
|
|
|
|
|
@app.context_processor |
|
|
|
def inject_general_info(): |
|
|
|
return dict(festival_general_info=festival_general_info_cache) |
|
|
|
# Fetch the data here, inside the function that runs for every request. |
|
|
|
# This guarantees the data is always fresh from Contentful. |
|
|
|
festival_info = contentful_service.get_general_info() |
|
|
|
return dict(festival_general_info=festival_info) |
|
|
|
|
|
|
|
@app.route('/') |
|
|
|
def index(): |
|
|
@ -44,11 +40,12 @@ def events(): |
|
|
|
@app.route('/exhibitions') |
|
|
|
def exhibitions(): |
|
|
|
exhibition_info = contentful_service.get_exhibition_list_info() |
|
|
|
print(exhibition_info) |
|
|
|
#print(exhibition_info) |
|
|
|
return render_template('list.html', title='Exhibitions', exhibition_info=exhibition_info) |
|
|
|
|
|
|
|
@app.route('/exhibitions/<ex_type>') |
|
|
|
def exhibition_type(ex_type): |
|
|
|
|
|
|
|
if ex_type == "local-artists-network": |
|
|
|
ex_type = "LAN" |
|
|
|
elif ex_type == "unsettling-the-algorithm": |
|
|
@ -57,7 +54,11 @@ def exhibition_type(ex_type): |
|
|
|
ex_type = "ES" |
|
|
|
elif ex_type == "starts4waterii": |
|
|
|
ex_type = "S4W2" |
|
|
|
elif ex_type == "imma-living-canvas-x-beta": |
|
|
|
ex_type = "IMMA" |
|
|
|
|
|
|
|
exhibitions = get_all_content('exhibition') |
|
|
|
print(ex_type) |
|
|
|
return render_template('list-exhibitions.html', title="Exhibitions", content=exhibitions, ex_type=ex_type) |
|
|
|
|
|
|
|
@app.route('/conferences') |
|
|
|