Converting a web2py web site to a static web site
I am building a web site using the web2py framework. The site uses data stored in MySQL database to build an index page of crops. For each crop, there is a link to a page which is built to display all pests attacking the crop.
I would like to host a copy of this as a static site in GitHub pages. Creating the static site was surprisingly easy:
- Run the web2py site in a local test browser.
- In an empty folder, use wget to save local a local copy of every page generated by the site:
wget --recursive --no-clobber --page-requisites \ --adjust-extension --convert-links \ --restrict-file-names=windows \ --no-parent \ http://127.0.0.1:8000/pestlist/default/crop_index
- On the crop_index.html page, change links to the pest_index.html pages. Easily done using relace all in atom or some other editor.
- Upload all files to a GitHub repo and enable GitHub pages for the repo.
- Create an index.html page in the top level folder of the repo which links to crop_index.html.