CURENT / agvis

Geo-visualization for energy system
https://ltb.curent.org
GNU General Public License v3.0
7 stars 5 forks source link

Replace SimpleHTTPServer with Flask web application using Gunicorn #49

Closed zmalkmus closed 1 year ago

zmalkmus commented 1 year ago

In the Dockerfile, there is a line that clones the repository from my agvisdev repository to compile and run agvis. When the merge is complete it will have to be updated to be the official repository. I had to leave this in for testing docker with this pull request.

With that being said, I was successfully able to convert the SimpleHTTPServer backend to a Flask web application. I took care to make the installation and use work exactly the same as before. After installing agvis normally, the web app can be run through the Gunicorn web server gateway interface (WSGI) using agvis run. The default host and port is still localhost:8810. The --static parameter of the command has now been removed as all static files must be served from the static folder included in the build.

image

AGVis can be run easily now without the use of docker.

image

When running agvis through docker, it requires waiting a couple seconds for the flask app to launch.

image

Starting Agvis

I have not tested using other WSGIs but they should all be able to be used to start AGVis manually in a similar manner. I believe Gunicorn to be the best option and, thus, I have made it a requirement of AGVis.

zmalkmus commented 1 year ago

I am doing a code review for myself. I ended up added updated print statements and error checking because I didn't feel like it was adequate. I believe what I have now is good. I have tested it on a couple PCs. It interacts the same, if not better than it did before.