From f7dd7c40f856fc05c102db77bc42c9b6204efddc Mon Sep 17 00:00:00 2001 From: Don Garrett Date: Fri, 31 Mar 2023 14:32:59 -0500 Subject: [PATCH] Setup minimal flask environment. --- .gitignore | 3 +++ .vscode/launch.json | 25 +++++++++++++++++++++++++ README.md | 12 ++++++++++++ app.py | 16 ++++++++++++++++ requirements.txt | Bin 0 -> 312 bytes static/site.css | 27 +++++++++++++++++++++++++++ templates/dictionary.html | 9 +++++++++ templates/layout.html | 26 ++++++++++++++++++++++++++ templates/solver.html | 9 +++++++++ wordle.py | 1 + 10 files changed, 128 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/launch.json create mode 100644 app.py create mode 100644 requirements.txt create mode 100644 static/site.css create mode 100644 templates/dictionary.html create mode 100644 templates/layout.html create mode 100644 templates/solver.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..72f6cdc --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.pyc +.venv +__pycache__ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..c612c97 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Flask", + "type": "python", + "request": "launch", + "module": "flask", + "env": { + "FLASK_APP": "app.py", + "FLASK_DEBUG": "1" + }, + "args": [ + "run", + "--no-debugger", + "--no-reload" + ], + "jinja": true, + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 90d5771..bf64bf0 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,15 @@ The internal dictionary is derived from the kind folks at: This disctionary does NOT match the official worldle dictionary, so it certainly contains words not accepted by the official wordle app, and is probably missing words available to the offical game. + +Setup virtual environment: + py -m vent .venv + .\.venv\Scripts\activate + pip install -r requirements.txt + +Run flask web server: + py -m flask run + +Notes: + To enable python virtual environments, you first need to do: + Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser \ No newline at end of file diff --git a/app.py b/app.py new file mode 100644 index 0000000..b9c3335 --- /dev/null +++ b/app.py @@ -0,0 +1,16 @@ +#!/usr/bin/python + +from flask import Flask +from flask import render_template + +app = Flask(__name__) + + +@app.route("/") +def solver(): + return render_template("solver.html") + + +@app.route("/dictionary") +def dictionary(): + return render_template("dictionary.html") diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b91373b19f1803e79f2dd7cce4a02a872ed4ea3 GIT binary patch literal 312 zcmZXPKM#U16vS^f@v9gFV^~}rOq>{;iK0P}l0pal@anGxLX2syf8M=!cm2F`IrTDX zRe)4GR;-mG5NoN0&Z + + + + + {% block title %}{% endblock %} + + + + + + +
+ {% block content %} + {% endblock %} +
+ +
+ + + \ No newline at end of file diff --git a/templates/solver.html b/templates/solver.html new file mode 100644 index 0000000..75e65ea --- /dev/null +++ b/templates/solver.html @@ -0,0 +1,9 @@ +{% extends "layout.html" %} + +{% block title %} +Solver! +{% endblock %} + +{% block content %} +Welcome to solver! +{% endblock %} diff --git a/wordle.py b/wordle.py index ab32e8e..011f632 100644 --- a/wordle.py +++ b/wordle.py @@ -29,6 +29,7 @@ _invalid_words = set(['staia', 'erept', 'boily', 'bolty', 'pindy', 'hyrse', 'hir 'skeel', 'telae', 'genae', 'beata', 'beala', 'macco', 'beele', 'divet', 'vedet', 'stail', 'roter', 'fikie', 'muang', 'nurry']) + def dictionary(): if not _wordle_dictionary: with open('words_alpha.txt') as word_file: