How to retrieve the values of environment variables in cpanel?

1,033 views
Skip to first unread message

Walter Randazzo

unread,
Feb 7, 2022, 8:29:00 PM2/7/22
to django...@googlegroups.com
Hi there, good night.   

Does anybody know how to set up environment variables in a cpanel shared hosting?

I've found the way to declare the variable name and the value through the "Setup Python App" section, but  I didn't find the way to retrieve the value in the settings file.

Please note that cpanel has no terminal.

Thanks in advance,



imad latch

unread,
Feb 8, 2022, 9:12:42 AM2/8/22
to Django users
I think you will have limited abilities without terminal but you can try it anyway .
and for passenger_wsgi.py in your /home/user/django-project/

import sys, os
INTERP = "/home/user/django-project/django-env/bin/python3"
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)

from  project.wsgi import application

I hope this helps

Walter Randazzo

unread,
Feb 8, 2022, 9:19:40 AM2/8/22
to django...@googlegroups.com
Hi Imad,

Thanks very much for your help.

Ill try that in the next few days also Ill let u know how it goes.

Thanks bro!




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7291e6c0-98bc-4d64-8f42-a173f4e8aa0an%40googlegroups.com.

Walter Randazzo

unread,
Feb 18, 2022, 11:01:04 PM2/18/22
to django...@googlegroups.com
Hi Imad,

I've just follow up the steps u suggested with no luck. I think i miss up something.

How you set the SECRET_KEY variable in  settings.py file?


Thanks in advances,


Walter Randazzo

unread,
Feb 18, 2022, 11:47:15 PM2/18/22
to django...@googlegroups.com
To All,

I was able to successfully setup  environment variables in cpanel using the package python-dotenv.

Here is the instructions that I followed up: 

Regards,


Reply all
Reply to author
Forward
0 new messages