Closed fungjj92 closed 5 years ago
I believe all comments are addressed now.
The big picture changes were:
-d
flag.Taking a look at this now.
Can we add .pyc
to .gitignore
?
I followed the instructions in the README to build and run the project with the non-Docker Python scripts. Everything worked as described, with the tiny exception of having to prefix python scripts/update.py
with sudo
to get it to work on my machine.
Trying out the Docker versions now.
Docker versions of these scripts work great!
I was able to run ./scripts/update.py -d
and ./scripts/server.py -d
and ./scripts/create_static.py -d
and each of them worked.
Question: where are the static assets supposed to be after running create_static.py -d
? I checked in the dist
dir but don't see anything there.
I made a few comments inline about adjusting the README instruction for how to stop the service to make it more precise. Aside from that this is nearly good to go, though!
@kellyi The only static file generated is index.html
. I imagined that static file compilation and zipping would happen in a later card, such as #1087 or #1100
Oops! I thought I had made that change but it snuck away. Thanks for the multiple speedy reviews! I will update.
Updated ~
Thanks so much for the thorough reviews! FYI @caseycesari I'm merging this to unblock further Task 1 work. LMK if you have any followup, we can make cards for them.
Overview
The next step in the static site conversion is that we add a templating engine that subs in data from custom JSON into templates that comprise the app. I added Jinja2 as the templating engine and process
region.json
forindex.html
as proof of concept that Jinja2 works for our needs. While we don't use Jinja2 frequently, its template syntax is familiar as it is strongly inspired by Django. Jinja2 is very lightweight as it only provides templating functionality and is very popular among pythonistas.Connects #1086
Demo
Serving the templated
index.html
shows that variables are substituted.Running the server looks like
Notes
There's a lot of context in the commit messages, check them out. The script
main.py
writes the jinja template to disk. This workflow works for our dev envir andbuild.py
in the geosite-build process whereby we will return zipped static site files to the client to serve on their own.Refreshing the browser recompiles and writes templates whoot
Testing Instructions
~Create the container, install deps, and run the server
./scripts/update
./scripts/server
~Follow the new README.md. Check that all 6 script commands work.
python ./scripts/server.py
python ./scripts/update.py
python ./scripts/create_static.py
python ./scripts/server.py -d
python ./scripts/update.py -d
python ./scripts/create_static.py -d
Visit http://localhost:54633 and see that variables are slotted in from region.json. The most prominent one is the text "Geosite Framework Sample" in the middle
Change the
titleMain
value inregion.json
. Refresh the browser and see that the changes are reflected.