4 min read

My Most Recent Project

Thermodynamics is fun
My Most Recent Project
My edited site

This is going to be a short little post explaining how I made changes to a website I use for Thermodynamics. A little about the website use, it's call "CoolPropGit" and is a web interface for interacting with CoolProp. CoolProp is a python library for finding the thermodynamic properties for materials. We are allowed to use this website to complete homework and in tests to lookup the thermodynamic properties of materials. The base website for already running server was Web2Py, which is a service that allows you use a combination of HTML and Python to code a website. This website had a couple small challenges however because it used units that where not overly helpful (using Kelvin instead of Celsius). It also did not output Internal Energy however it did output Enthalpy. Because we knew Enthalpy we could convert it to Internal Energy with the equation, h = U + PV. The "h" is Enthalpy, "U" is Internal Energy, "P" is pressure and "V" is volume. We knew all the properties other than U so we could solve for it. With all this knowledge, and knowing that I could probably very change the code of the site, I started trying to find out how to run even run the site. I couldn't be that difficult, right... Right?

Web2Py

The answer is, maybe not. The first thing I tried to do was install Web2Py on a Github virtual environment. I mean, I have console access so I have to be able to install what I need. The short answer was no, it wasn't going to be that easy, and I can't infinity run the server on it there anyway. So I moved on to my next idea, I have a dedicated server, why not install it there, I've got plenty of other things running there so why wouldn't it work with Web2Py as well. It would but the default installer used Apache (yikes that old), and I use Nginx on my server. I had an idea of running it in a docker container but did a little searching and found no one else had done it so I decided to not go down that path. So many running it on my own server isn't the best. I went back the original website I was using and saw that it was a domain for "ibell.pythonanywhere.com". Pythonanywhere must be a hosting server and for a matter of fact it is! and even better, it has a free tier. Perfect, I can use this to host the server. It's going to be smooth sailing from here on I'd assume.

Installation

Answer is maybe not. I go through the setup process of getting a server setup through this service. It has a preset option to install Web2Py, perfect, easy peasy. I set a admin password, great, save it to my keychain, and then go to the website. I go to the admin panel, and oh no, the admin passwords not working? What, I saved it? Ok, well, maybe it didn't save properly or I copy the wrong password or something, so I try again, but it's the same issue, password wrong. Okay, so I'm thinking maybe it's on of those weird things when you have a super long password, it cuts off the end of it without you realizing, it happens (it's really annoying), but it happens. So I go and wipe it again, and this time, and use a shorter password, and it works. Thank goodness. Next up, installing code for the thermo properties, shouldn't be too hard, drag and drop in the applications folder.

Installation Pt. 2

No, it's not a drag and drop like you'd think. What you got to do is go into the admin area and set it up so it pulls from git repo, why? I don't know. I think you can only upload a specific file type which is not a .zip. Does it say that anywhere, no but it's okay, I figure it out. I go to launch the website and I get a error page. Ugh, another problem? I read this error and find oh, it can't find a "module". I have no idea what a module is, maybe I should but that's not the point, I don't generally code in python (is it even a python thing or just Web2Py?) I do some research on how to install the modules I need for this to work. There is not really any definitive information on how to, but I guessed maybe it works something like Javascript and it's node_modules file work. Once you run the install command it puts the files it needs into it. So I run "pip install modulename". It installs and everything but it doesnt change anything else. What am I doing wrong? I do more and more research finding nothing that helps. I try to find out how to say a the python install files to a specific place on the drive. The place I find it is in the -h for pip install. I run the command and oops, I set the file directly wrong. It installs all of the repos directly into the file your in, not into the modules folder. Okay, I fix all the chaos I caused in the file and edit my command to correctly place the modules. It changes the error, I need to install another module. Just like that, I got the website work, easy peasy lemon sqeezy.

The End

The next step is to actually change the code, which goes so much smoother than the rest of the project went. I find that I don't even need to calculate Internal Energy, it gives it to you as variable, however the webpage just doesn't display it. Long story short, maybe not worth my time, but you know, I learned a little bit more about programming so it makes it all worth. Also, I had fun doing it and realistically didn't take me longer than 3-4 hours.

Thermo