Closed theotherguy2175 closed 6 years ago
do this in unix console:
cd ~/ThermOS /usr/local/bin/gunicorn thermostat_web:app -b 0.0.0.0:8080
navigate to
your.ThermOS.ip.address:8080
click on schedule. If you still get the error, copy and paste the output from the unix console.
/usr/local/bin/gunicorn thermostat_web:app -b 0.0.0.0:8080 [2018-06-30 14:01:31 +0000] [18651] [INFO] Starting gunicorn 19.8.1 [2018-06-30 14:01:31 +0000] [18651] [INFO] Listening at: http://0.0.0.0:8080 (18651) [2018-06-30 14:01:31 +0000] [18651] [INFO] Using worker: sync [2018-06-30 14:01:31 +0000] [18656] [INFO] Booting worker with pid: 18656 ^C[2018-06-30 15:29:55 +0000] [18651] [INFO] Handling signal: int [2018-06-30 15:29:55 +0000] [18656] [INFO] Worker exiting (pid: 18656) [2018-06-30 15:29:55 +0000] [18651] [INFO] Shutting down: Master
sorry, my mistake. I forgot that gunicorn doesn't output the debug information without some edits. do this instead:
cd ~/ThermOS
sudo service nginx stop
sudo python thermostat_web.py
navigate to the thermostat like normal (without the :8080) and it should output any errors encountered.
This was the output i got. THank you for your help!
pi@raspberrypi:~/ThermOS $ sudo python thermostat_web.py
ok, let's see what version of Jinja2 that you have.
pip show Jinja2
Name: Jinja2 Version: 2.7.3 Location: /usr/lib/python2.7/dist-packages Requires: markupsafe
ah, that's the problem. it's an old version of jinja.
this should fix the problem.
pip install --upgrade Jinja2
When trying to perform the update this is the error I revived
pi@raspberrypi:~ $ pip install --upgrade Jinja2 Downloading/unpacking Jinja2 from https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl#sha256=74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd Downloading Jinja2-2.10-py2.py3-none-any.whl (126kB): 126kB downloaded Downloading/unpacking MarkupSafe>=0.23 from https://files.pythonhosted.org/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/MarkupSafe-1.0.tar.gz#sha256=a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665 (from Jinja2) Downloading MarkupSafe-1.0.tar.gz Running setup.py (path:/tmp/pip-build-yReKKv/MarkupSafe/setup.py) egg_info for package MarkupSafe
Installing collected packages: Jinja2, MarkupSafe Found existing installation: Jinja2 2.7.3 Not uninstalling Jinja2 at /usr/lib/python2.7/dist-packages, owned by OS Compiling /tmp/pip-build-yReKKv/Jinja2/jinja2/asyncfilters.py ... File "/tmp/pip-build-yReKKv/Jinja2/jinja2/asyncfilters.py", line 7 async def auto_to_seq(value): ^ SyntaxError: invalid syntax
Compiling /tmp/pip-build-yReKKv/Jinja2/jinja2/asyncsupport.py ... File "/tmp/pip-build-yReKKv/Jinja2/jinja2/asyncsupport.py", line 22 async def concat_async(async_gen): ^ SyntaxError: invalid syntax
Can't roll back Jinja2; was not uninstalled Cleaning up... Exception: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main status = self.run(options, args) File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 295, in run requirement_set.install(install_options, global_options, root=options.root_path) File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install requirement.install(install_options, global_options, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/pip/req.py", line 672, in install self.move_wheel_files(self.source_dir, root=root) File "/usr/lib/python2.7/dist-packages/pip/req.py", line 902, in move_wheel_files pycompile=self.pycompile, File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 214, in move_wheel_files clobber(source, lib_dir, True) File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 204, in clobber os.makedirs(destdir) File "/usr/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/Jinja2-2.10.dist-info'
Storing debug log for failure in /home/pi/.pip/pip.log
Ok, so nevermind i just had to run that previous command with sudo and it upgraded. Sadly its still giving the same error when trying to add an entry into the schedule.
that's really weird. After running it like this:
cd ~/ThermOS
sudo service nginx stop
sudo python thermostat_web.py
is it still spitting out the
TemplateAssertionError: no test named 'equalto'
error?
if so, do this
python
import jinja2
jinja2.__version__
*note: there are two underscores on each side of 'version'
(ctrl + z to stop the python console)
this is the python log
pi@raspberrypi:~/ThermOS $ sudo python thermostat_web.py
And the Jinja2 version is 2.7.3
ok, so jinja didn't actually update. lets just fully uninstall it, then re-install it.
sudo pip uninstall Jinja2 -y sudo pip install Jinja2==2.10
You will probably get a couple of syntax errors, but it should install successfully.
So I was able to uninstall Jinja to the latest version but now its doing the famous
502 Bad Gateway nginx/1.6.2
FIXED IT, after rebooting and installing thermos again. It is successfully taking the schedule now. Thank you!
This is an amazing setup and i appreciate the quick responses. You make doing fun hobbies like this enjoyable!
cool. Glad you got it working. Let me know if you run into any other problems!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.