I have problem with python selenium in Django when my project run on apache2 - Ubuntu Desktop. My app send forms to selenium script which reset user password. If im running server like this python3 manage.py runserver everything is fine and works good. When app works on apache i got error like this:
Exception Type: TimeoutException Exception Value: Message: Failed to read marionette port
Im sending forms - "name" and "ID" from function 'submitmyfrom' to 'reset_user_pw'.
view.py:
def submitmyfrom(request):
form = FormsReset(request.POST)
my_name = request.POST['name']
my_id = request.POST['id']
ip = request.META.get('REMOTE_ADDR')
if len(id) < 12:
passwd = reset_user_pw(user_name=my_name)
mydictionary = {
"my_name" : my_name,
"my_id" : my_id,
'password' : passwd
}
return render(request,'submitmyfrom.html', context=mydictionary)
reset_user_pw:
def reset_user_pw(user_name):
os.environ['MOZ_HEADLESS'] = '1'
pwd = mypwd
LoginName = "login"
user_login = user_name
cert = webdriver.FirefoxProfile()
cert.accept_untrusted_certs = True
web = webdriver.Firefox(executable_path='/var/www/my_project/src/geckodriver',
log_path='/var/www/my_project/src/Reset/geckodriver.log',
service_log_path='/var/www/my_project/src/myapp/geckodriver.log')
web.get('https://example.com/test')
time.sleep(1)
next is the rest of the function reset_user_pw I use firefox and would ideally like to stay with it
What can i do to make it on apache2. I remind you that the python3 manage.py runserver run fine