Make Shakespeare Lookup Web Interface

How make a web version of the Python Shakespeare program.

  1. Get a copy of https://github.com/jimskon/PythonNameLookup
  2. Get a copy of https://github.com/jimskon/shakeconsolepy
  3. Create a new directory: shakewebpy
  4. Copy PythonNameLookup from into shakewebpy
  5. Rename namelookup.css  namelookup.html  namelookup.js namelookup.py to shakewebpy.*
  6. Copy textindex.py and shakeconsole.py from shakeconsolepy into shakewebpy
  7. Open both shakeconsole.py and shakewebpy.py in an editor.
  8. Delete sortedcontainers, NameEntry, NameMap, lookup, lookup10
  9. Change file path to /home/class/shake/Shakespeare.txt
  10. After “import os” include the code from textindex.py
  11. Delete NameMap creation
  12. Change if statement to check or form value “word”, and change next line to get value “word”
  13. Get rid of got to check for name type
  14. Get all of the code from shakeconsole.py and put above main in shakewebpy.py
  15. Move last three lines into main (change file to fileName)
  16. Move all the code from textindex.py into shakewebpy.py. Make sure NOT to include the “import” for text index.
  17. Change lookup words to have a “word” parameter, an remove loop. Make code put results into list.
  18. In main line make a loop to print all lines. Add <br /> at the end of each line for html.
  19. Edit shakewebpy.html. Change for word lookup. (Get rid of pull down). Change file references.
  20. Edit shakewebpy.js. Remove pulldown stuff, get rid of table stuff. Change getMatches to call correct program, and only pass word. In fetch change json to text. In processResults merely put result to output div.
  21. Edit Makefile and change all namefile to shakewebpy, pNames to shakewebpy
  22. mkdir /var/www/html/class/softdev/yourusername/shakewebpy
  23. Make everything into a git project, and save!

Scroll to Top