'redis_host' Displaying in any other browser except for Chrome on laptop.
Good Day everyone.
SOLVED See end for solution.
What does: 'redis_host' mean when displayed on it's own in a python console window. I know what the redis_host means in connections terms as I have successfully connected to the Redis db and transacted.
I have tested running a Python console application in a few browsers and devices now.
The Repl in question is Here
If I run the embedded Repl in my Chrome browser, the console application runs as it should. The moment I test with other browsers or devices (i.e my mobile phone), after I click "Run" I see: 'redis_host' displayed in the console.
What I have tried:
- Switching between a windows, ubuntu and Redis Enterprise Cloud server, with the same results.
- Testing in Firefox, Edge, Safari, IE with no desired result.
- Repl runs as it should on laptop running Chrome and Windows 10 on it's own in the Repl or embedded in an external website.
NB: I have my Redis server credentials added to the .env file, could that be a possible conflict ?
Screenshot of 'redis-host' displayed in console:
Running through Chrome, it appears as it should:
Please kindly assist with any ideas or thoughts, thank you!
Half Resolved
I managed to resolve this by changing the way the Python code retrieves the enviroment variables.
I added:
from dotenv import load_dotenv
load_dotenv()
and instead of: host=os.environ('redis_host')
I changed it to: host=os.environ.get('redis_host')
Which gave me a successful connection in am embedded browser using Edge:
But problem now is:
Yet: Where I am concatenating strings with integers, I am using proper syntax, eg: if r.exists(str(name) + '_pin'):
What I have tried: Is to replace all 0's with int() instances, but still same error persists.
NB: Running this Repl on my laptop using Chrome gives no issues at all.
Will carry on soldiering but would appreciate any input, thanks!
SOLVED
Fix: It seems the .env values are not carried over when embedding a python console. So I scrapped the .env all together and used a temporary base64 solution. Will do the proper Hash in a bit.