diff --git a/api/views.py b/api/views.py index 13eaa54..53e951a 100644 --- a/api/views.py +++ b/api/views.py @@ -14,6 +14,7 @@ from selenium.webdriver.common.keys import Keys from .scrapper import scrape_settings,scrape_properties +from django.conf import settings import os @api_view(["POST"]) @@ -38,13 +39,14 @@ def login(request): key=request.META['HTTP_AUTHORIZATION'] user_email = request.data['email'] user_password=request.data['password'] - + print(settings.CHROMEDRIVER_PATH) + print(settings.CHROME_BIN) chrome_options = webdriver.ChromeOptions() chrome_options.add_argument("--headless") chrome_options.add_argument("--disable-dev-shm-usage") chrome_options.add_argument("--no-sandbox") - chrome_options.binary_location = os.environ.get("GOOGLE_CHROME_BIN") - selenium = webdriver.Chrome(executable_path=os.environ.get("CHROMEDRIVER_PATH"), chrome_options=chrome_options) + chrome_options.binary_location = settings.CHROME_BIN + selenium = webdriver.Chrome(executable_path=settings.CHROMEDRIVER_PATH, chrome_options=chrome_options) #selenium = webdriver.Chrome(ChromeDriverManager().install(),chrome_options=chrome_options) selenium.get('https://app.earth2.io/login/auth0') diff --git a/earth2/settings.py b/earth2/settings.py index 8673b65..725db1e 100644 --- a/earth2/settings.py +++ b/earth2/settings.py @@ -14,8 +14,8 @@ import dj_database_url # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - - +CHROME_BIN = os.environ.get("GOOGLE_CHROME_BIN") +CHROMEDRIVER_PATH = os.environ.get("CHROMEDRIVER_PATH") # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/