diff --git a/__pycache__/contextualise.cpython-35.pyc b/__pycache__/contextualise.cpython-35.pyc index 1e4b54c..6e181bb 100644 Binary files a/__pycache__/contextualise.cpython-35.pyc and b/__pycache__/contextualise.cpython-35.pyc differ diff --git a/contextualise.py b/contextualise.py index c351efa..48f8b84 100644 --- a/contextualise.py +++ b/contextualise.py @@ -1,5 +1,4 @@ -from flask import Flask, url_for, render_template, Markup, redirect, request, flash -from flask import session as login_session +from flask import Flask, url_for, render_template, Markup, redirect, request, flash, session, make_response from config import Config import json import os @@ -12,6 +11,8 @@ app = Flask(__name__, static_url_path='', static_folder="static", template_folde app.jinja_env.add_extension('jinja2.ext.loopcontrols') app.config.from_object(Config) +#############cookie stuff +# app.secret_key = os.urandom(24) # setting variables for holding paths, folder names and the one file for description path = "static/files/" @@ -25,7 +26,6 @@ positioninarray = 8 #counter listofdicts=[] #to be able to import and use json content datafromjson = [] - #test getting json file from id id = "17" jsonfilefordescription = "files/"+id+"/"+id+".json" @@ -34,11 +34,6 @@ jsonfilefordescription = "files/"+id+"/"+id+".json" pathofwords = [] pathofnumbers = [] -#reading wordlist.json -with open('wordlist.json', 'r') as f: - wordlist_dict = json.load(f) - - #listing paths and files, not in order but well... for path, subdirs, files in os.walk(path): for name in files: @@ -71,14 +66,17 @@ print("-------------------------") dict = {} #dict for the form entries -with open("static/"+jsonfilefordescription, 'r') as f: +with open("static/"+jsonfiles[4], 'r') as f: data_dict = json.load(f) datafromjson = data_dict["files"] print(datafromjson) @app.route("/") def home(): - return render_template('home.html') + words = ["way", "blablabla", "uqhdiuqsiud"] + res = make_response(render_template('home.html')) + res.set_cookie("qhdqhd",str(words) , max_age=60*60*24*365*2) + return res @app.route('/about/') def about(): @@ -92,7 +90,6 @@ def all(): counter2=0 return render_template('all.html', file=thefile, listingfiles=listingfiles, jsonfiles=jsonfiles, listofdicts=listofdicts, counter2=counter2) - @app.route('/description') def description(): #open json file, list filepaths in array and loop with thefile @@ -116,7 +113,11 @@ def description(): @app.route('/diverge', methods=['GET']) def diverge(): searchterm=request.args.get('search') - return render_template('diverge.html', wordlist_dict=wordlist_dict, searchterm=searchterm) + return render_template('diverge.html', searchterm=searchterm) + +@app.route('/listofwords') +def listofwords(): + return render_template('listofwords.html') if __name__ == '__main__': app.run(debug=True) diff --git a/templates/layout.html b/templates/layout.html index 9a1bb06..d87864a 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -15,6 +15,7 @@