-
-
Save neerajgupta2407/762c93ff3aac588ff53f62baa67801cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALLOWED_HOSTS=x.x.x.x | |
ALLOWED_CLIENT_HOSTS=x.x.x.x | |
DEBUG=True | |
SECRET_KEY=12345678 | |
INTERNAL_IPS=127.0.0.1,x.x.x.x, | |
DEFAULT_COUNTRY=IN | |
DEFAULT_CURRENCY=INR | |
APP_MOUNT_URI=/dashboard/ | |
API_URI=http://x.x.x.x:8000/graphql/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import sys | |
if __name__ == "__main__": | |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "saleor.settings") | |
try: | |
from decouple import RepositoryEnv | |
file_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) | |
#print("{}/.env".format(file_path)) | |
for k,v in RepositoryEnv("{}/.env".format(file_path)).data.items(): | |
print(k, v) | |
os.environ[k] = v | |
except Exception as e: | |
#print(e) | |
pass | |
from django.core.management import execute_from_command_line | |
execute_from_command_line(sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Install python decpuple: pip install python-decouple | |
2. create .env file at root path. (in folder where manage.py exists) and update the below values. | |
3.) Append below code in setting.py just above 'get_list' function. | |
try: | |
from decouple import RepositoryEnv | |
file_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) | |
#print("{}/.env".format(file_path)) | |
for k,v in RepositoryEnv("{}/.env".format(file_path)).data.items(): | |
print(k, v) | |
os.environ[k] = v | |
except Exception as e: | |
#print(e) | |
pass | |
### Alternativly, since there is not going to be any change manage.py file, so you can also edit it . Find the attached file. | |
Sample code: | |
try: | |
from decouple import RepositoryEnv | |
file_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) | |
#print("{}/.env".format(file_path)) | |
for k,v in RepositoryEnv("{}/.env".format(file_path)).data.items(): | |
print(k, v) | |
os.environ[k] = v | |
except Exception as e: | |
#print(e) | |
pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment