Page 1 of 1

Saratoga templates on Raspberry PI

Posted: Sun 18 Sep 2016 1:51 pm
by Adrian Hudson
Hi,
I reckon this is a simple problem but I am darned if I know whats going on.

I am porting my website from Windows to RPI and its going okay - ish. One problem I don't seem to be able to get over is the templates not finding my realtime.txt file. Here is a line from the Apache log:

... 14:26:49 +0100] "GET /realtime.txt?1474205210632 HTTP/1.1" 404 508 "http://weatherpi/wxgraphs.php" ...

404 shows the file is not found but it IS there in the folder (and all lowercase, in case anyone is wondering). What is the significance of the number after the question mark? I half remember something about this being something to do with ensuring a fresh copy of realtime.txt is obtained every request but I can't for the life of me remember where that number comes from or what it means or if it is anything to do with the file not being found.

Can anyone help please?

Re: Saratoga templates on Raspberry PI

Posted: Sun 18 Sep 2016 2:06 pm
by steve
It's a pseudo-random number usually based on the current date ad time, to stop any caching happening. It could be that your web server doesn't like the extra bit added on. I'm afraid I have no idea what you need to do to it if that is the case, but I'm sure someone who knows what they're talking about will be along shortly. I'll get back to packing the RV...

Re: Saratoga templates on Raspberry PI

Posted: Sun 18 Sep 2016 3:03 pm
by Adrian Hudson
Thanks Steve. The problem doesn't seem to be anything to do with this number in the url. I just requested the realtime.txt manually from a web browser and the pi responded with the file, whether or not I appended a question mark and a number. So, I'm stumped.

I have tried

$SITE['realtimefile'] = './realtime.txt'; // directory and name of Cumulus realtime.txt file

and

$SITE['realtimefile'] = 'realtime.txt'; // directory and name of Cumulus realtime.txt file

in Settings-weather.php

neither works.

I'm guessing its something to do with case sensitivity of filenames on linux but I am darned if I can find it!

Re: Saratoga templates on Raspberry PI

Posted: Sun 18 Sep 2016 5:24 pm
by jlmr731
Now im not using a RPI but i am on a linux system and in my Setting-weather.php i use the absolute path to my realtime file.
Also i am grabbing it from the CumulusMX program dir since it is running on the linux system like /home/me/CumulusMX/realtime.txt
Now if your uploading the realtime.txt to your pi into the web dir try using that say /var/www/realtime.txt or wherever your web root is
For me i have always found using the full path works best. and yes everything is case sensitive
Hope this helps you

Re: Saratoga templates on Raspberry PI

Posted: Sun 18 Sep 2016 6:09 pm
by Adrian Hudson
@jlmr731

Many thanks for your suggestion. I am embarrassed to say I had the whole site in a subfolder of \www\html and had forgotten! Quoting the whole path indeed fixed it! Thanks.

Re: Saratoga templates on Raspberry PI

Posted: Sun 18 Sep 2016 9:42 pm
by saratogaWX
It was likely a request created by ajaxCUwx.js JavaScript. If your website is not located in the document root, then you need to change ajaxCUwx.js

Code: Select all

var realtimeFile = '/realtime.txt'; //  URL location of realtime.txt relative to document root of website
to

Code: Select all

var realtimeFile = './realtime.txt'; //  URL location of realtime.txt relative to document root of website
or

Code: Select all

var realtimeFile = 'realtime.txt'; //  URL location of realtime.txt relative to document root of website
to have it come from the same directory as the template. The Settings.php settin for

Code: Select all

$SITE['realtimefile'] = 'realtime.txt'; // directory and name of Cumulus realtime.txt file
applies to the PHP parts of the template.. the ajaxCUwx.js has to be changed separately.