ethemguner / dobot

Real Time Crypto Currency Price Tracker by using Django
2 stars 0 forks source link

get_environment_variable doesn't work #14

Closed ethemguner closed 2 years ago

ethemguner commented 2 years ago

local and prod creds currently is same. we need to change that.

RecNes commented 2 years ago

Why not use https://pypi.org/project/python-dotenv/

PS: in case of using this library, local environment folder name must be different then ".env"

ethemguner commented 2 years ago

Why not use https://pypi.org/project/python-dotenv/

PS: in case of using this library, local environment folder name must be different then ".env"

we may use that. but i think problem is misconfiguration on production server.

i added creds in ~/.bashrc in server. but get_environment_variable("DBUSER")returning none. but when i run echo $DBUSER it's returning "dobot" which is the user of the dobotdb.

RecNes commented 2 years ago

That's might be the .bashrc run before in parent environment?

Did you try to run echo $DBUSER after enabled the virtual environment?

ethemguner commented 2 years ago

result is same, "dobot" is the output. i might found the problem, if i run printenv output is:

SHELL=/bin/bash
PWD=/
LOGNAME=root
XDG_SESSION_TYPE=tty
MOTD_SHOWN=pam
HOME=/root
LANG=C.UTF-8
VIRTUAL_ENV=/var/www/env
SSH_CONNECTION=24.133.86.67 19195 65.108.153.121 22
XDG_SESSION_CLASS=user
TERM=xterm-256color
USER=root
SHLVL=1
XDG_SESSION_ID=573
LC_CTYPE=C.UTF-8
XDG_RUNTIME_DIR=/run/user/0
PS1=(env) ${debian_chroot:+($debian_chroot)}\u@\h:\w\$ 
SSH_CLIENT=24.133.86.67 19195 22
PATH=/var/www/env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus
SSH_TTY=/dev/pts/2
OLDPWD=/var
_=/usr/bin/printenv

i think environment variables for database is not in correct conf file?