coder
asked on
browser error Refused to connect to web application while the ports are open
Hi experts,
My web application is running on aws ubuntu 16. I have the following ports open from aws.
It has the following applications running on ubuntu
uwsgi with nginx - i Think it uses port 80
node.js with react - react is rendering on port 9009
webpack with webpack.config.js - which creates js file which will be using port 80
npm run django: runserver 0.0.0.0:8000 uses port 8000
elastic search :9200 uses port 9200
postgresql used port:5432
Please see the opened ports on aws. screenshot for reference.
With putty I connect to linux ubuntu machine with the following ip address 54.252.92.17
There is docker application which runs inside that linux box uses nginx, postgres, elasticsearch
When I run docker application, and I able to see from browser with http://54.252.92.17/
Where as when I run python manage.py runserver 0.0.0.0:8000 I am not able to see the application.
The site can't be reached 54.252.92.17 refused to connect error.
Whereas I can see the docker application when the docker is run.
Please help me why the python application is not running on the browser, where as Docker application runs well.
With python manage.py runserver 0,0,0,0:8000 I am running from the source code. Whereas with docker I am running the docker image.
Both are same application.
Please help me in fixing this issue.
with many thanks,
Bharath AK
My web application is running on aws ubuntu 16. I have the following ports open from aws.
It has the following applications running on ubuntu
uwsgi with nginx - i Think it uses port 80
node.js with react - react is rendering on port 9009
webpack with webpack.config.js - which creates js file which will be using port 80
npm run django: runserver 0.0.0.0:8000 uses port 8000
elastic search :9200 uses port 9200
postgresql used port:5432
Please see the opened ports on aws. screenshot for reference.
With putty I connect to linux ubuntu machine with the following ip address 54.252.92.17
There is docker application which runs inside that linux box uses nginx, postgres, elasticsearch
When I run docker application, and I able to see from browser with http://54.252.92.17/
Where as when I run python manage.py runserver 0.0.0.0:8000 I am not able to see the application.
The site can't be reached 54.252.92.17 refused to connect error.
Whereas I can see the docker application when the docker is run.
Please help me why the python application is not running on the browser, where as Docker application runs well.
With python manage.py runserver 0,0,0,0:8000 I am running from the source code. Whereas with docker I am running the docker image.
Both are same application.
Please help me in fixing this issue.
with many thanks,
Bharath AK
For the python app, have you tried connecting directly like http://54.252.92.17:8000 ? Seems like the command is set up to have it listen on port 8000.
ASKER
Hi Phillips,
I had tried http://54.*.*.*:8000
When I run python manage.py runserver 0.0.0.0:8000 I get the following error.
I got some other errors please see the errors below
Django version 1.11.1, using settings 'ntdl.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Internal Server Error: /
Traceback (most recent call last):
File "/usr/local/lib/python3.6/ dist-packa ges/django /core/hand lers/excep tion.py", line 41, in inner
response = get_response(request)
File "/usr/local/lib/python3.6/ dist-packa ges/django /utils/dep recation.p y", line 138, in __call__
response = self.process_request(reque st)
File "/usr/local/lib/python3.6/ dist-packa ges/django /middlewar e/security .py", line 25, in process_request
host = self.redirect_host or request.get_host()
File "/usr/local/lib/python3.6/ dist-packa ges/django /http/requ est.py", line 105, in get_host
if domain and validate_host(domain, allowed_hosts):
File "/usr/local/lib/python3.6/ dist-packa ges/django /http/requ est.py", line 579, in validate_host
if pattern == '*' or is_same_domain(host, pattern):
File "/usr/local/lib/python3.6/ dist-packa ges/django /utils/htt p.py", line 291, in is_same_domain
pattern = pattern.lower()
AttributeError: 'ellipsis' object has no attribute 'lower'
"GET / HTTP/1.1" 500 11970
Internal Server Error: /favicon.ico
Traceback (most recent call last):
File "/usr/local/lib/python3.6/ dist-packa ges/django /core/hand lers/excep tion.py", line 41, in inner
response = get_response(request)
File "/usr/local/lib/python3.6/ dist-packa ges/django /utils/dep recation.p y", line 138, in __call__
response = self.process_request(reque st)
File "/usr/local/lib/python3.6/ dist-packa ges/django /middlewar e/security .py", line 25, in process_request
host = self.redirect_host or request.get_host()
File "/usr/local/lib/python3.6/ dist-packa ges/django /http/requ est.py", line 105, in get_host
if domain and validate_host(domain, allowed_hosts):
File "/usr/local/lib/python3.6/ dist-packa ges/django /http/requ est.py", line 579, in validate_host
if pattern == '*' or is_same_domain(host, pattern):
File "/usr/local/lib/python3.6/ dist-packa ges/django /utils/htt p.py", line 291, in is_same_domain
pattern = pattern.lower()
AttributeError: 'ellipsis' object has no attribute 'lower'
"GET /favicon.ico HTTP/1.1" 500 11967
Please help me how to fix this error.
With Many thanks,
Bharath AK
I had tried http://54.*.*.*:8000
When I run python manage.py runserver 0.0.0.0:8000 I get the following error.
I got some other errors please see the errors below
Django version 1.11.1, using settings 'ntdl.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Internal Server Error: /
Traceback (most recent call last):
File "/usr/local/lib/python3.6/
response = get_response(request)
File "/usr/local/lib/python3.6/
response = self.process_request(reque
File "/usr/local/lib/python3.6/
host = self.redirect_host or request.get_host()
File "/usr/local/lib/python3.6/
if domain and validate_host(domain, allowed_hosts):
File "/usr/local/lib/python3.6/
if pattern == '*' or is_same_domain(host, pattern):
File "/usr/local/lib/python3.6/
pattern = pattern.lower()
AttributeError: 'ellipsis' object has no attribute 'lower'
"GET / HTTP/1.1" 500 11970
Internal Server Error: /favicon.ico
Traceback (most recent call last):
File "/usr/local/lib/python3.6/
response = get_response(request)
File "/usr/local/lib/python3.6/
response = self.process_request(reque
File "/usr/local/lib/python3.6/
host = self.redirect_host or request.get_host()
File "/usr/local/lib/python3.6/
if domain and validate_host(domain, allowed_hosts):
File "/usr/local/lib/python3.6/
if pattern == '*' or is_same_domain(host, pattern):
File "/usr/local/lib/python3.6/
pattern = pattern.lower()
AttributeError: 'ellipsis' object has no attribute 'lower'
"GET /favicon.ico HTTP/1.1" 500 11967
Please help me how to fix this error.
With Many thanks,
Bharath AK
ASKER
Hi Scott
Thankyou,
With Kind Regards,
Bharath AK
Thankyou,
With Kind Regards,
Bharath AK
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Phill,
I had checked the config inside /usr/bin/python-config and also inside my bin/python-config, and searched for ... in that file
but ... text is not all available in python-config file. Do I have check for any other file?
With Many Thanks,
Bharath AK
I had checked the config inside /usr/bin/python-config and also inside my bin/python-config, and searched for ... in that file
but ... text is not all available in python-config file. Do I have check for any other file?
With Many Thanks,
Bharath AK
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Phill
I had checked the following files manually opening and checking it
root@ip-10-252-14-11:/home /ubuntu/wo rkarea/sou rcecode/nt dl# python3 manage.py runserver 0.0.0.0:80
Performing system checks...
System check identified no issues (0 silenced).
March 21, 2018 - 17:59:58
Django version 1.11.1, using settings 'ntdl.settings'
Starting development server at http://0.0.0.0:80/
Quit the server with CONTROL-C.
Internal Server Error: /
Traceback (most recent call last):
File "/usr/local/lib/python3.6/ dist-packa ges/django /core/hand lers/excep tion.py", line 41, in inner
response = get_response(request)
File "/usr/local/lib/python3.6/ dist-packa ges/django /utils/dep recation.p y", line 138, in __call__
response = self.process_request(reque st)
File "/usr/local/lib/python3.6/ dist-packa ges/django /middlewar e/security .py", line 25, in process_request
host = self.redirect_host or request.get_host()
File "/usr/local/lib/python3.6/ dist-packa ges/django /http/requ est.py", line 105, in get_host
if domain and validate_host(domain, allowed_hosts):
File "/usr/local/lib/python3.6/ dist-packa ges/django /http/requ est.py", line 579, in validate_host
if pattern == '*' or is_same_domain(host, pattern):
File "/usr/local/lib/python3.6/ dist-packa ges/django /utils/htt p.py", line 291, in is_same_domain
pattern = pattern.lower()
AttributeError: 'ellipsis' object has no attribute 'lower'
"GET / HTTP/1.1" 500 12110
Internal Server Error: /favicon.ico
Traceback (most recent call last):
File "/usr/local/lib/python3.6/ dist-packa ges/django /core/hand lers/excep tion.py", line 41, in inner
response = get_response(request)
File "/usr/local/lib/python3.6/ dist-packa ges/django /utils/dep recation.p y", line 138, in __call__
response = self.process_request(reque st)
File "/usr/local/lib/python3.6/ dist-packa ges/django /middlewar e/security .py", line 25, in process_request
host = self.redirect_host or request.get_host()
File "/usr/local/lib/python3.6/ dist-packa ges/django /http/requ est.py", line 105, in get_host
if domain and validate_host(domain, allowed_hosts):
File "/usr/local/lib/python3.6/ dist-packa ges/django /http/requ est.py", line 579, in validate_host
if pattern == '*' or is_same_domain(host, pattern):
File "/usr/local/lib/python3.6/ dist-packa ges/django /utils/htt p.py", line 291, in is_same_domain
pattern = pattern.lower()
AttributeError: 'ellipsis' object has no attribute 'lower'
"GET /favicon.ico HTTP/1.1" 500 12107
Then I went inside the file /usr/local/lib/python3.6/d ist-packag es/django/ utils/http .py line 291 in is_same_domain
please see the implementation of is_same_domain I am not able find where the error is
def is_same_domain(host, pattern):
"""
Return ``True`` if the host is either an exact match or a match
to the wildcard pattern.
Any pattern beginning with a period matches a domain and all of its
subdomains. (e.g. ``.example.com`` matches ``example.com`` and
``foo.example.com``). Anything else is an exact string match.
"""
if not pattern:
return False
pattern = pattern.lower()
return (
pattern[0] == '.' and (host.endswith(pattern) or host == pattern[1:]) or
pattern == host
)
I am not able to find where the error is Please help in resolving this
With Many Thanks,
Bharath AK
I had checked the following files manually opening and checking it
root@ip-10-252-14-11:/home
Performing system checks...
System check identified no issues (0 silenced).
March 21, 2018 - 17:59:58
Django version 1.11.1, using settings 'ntdl.settings'
Starting development server at http://0.0.0.0:80/
Quit the server with CONTROL-C.
Internal Server Error: /
Traceback (most recent call last):
File "/usr/local/lib/python3.6/
response = get_response(request)
File "/usr/local/lib/python3.6/
response = self.process_request(reque
File "/usr/local/lib/python3.6/
host = self.redirect_host or request.get_host()
File "/usr/local/lib/python3.6/
if domain and validate_host(domain, allowed_hosts):
File "/usr/local/lib/python3.6/
if pattern == '*' or is_same_domain(host, pattern):
File "/usr/local/lib/python3.6/
pattern = pattern.lower()
AttributeError: 'ellipsis' object has no attribute 'lower'
"GET / HTTP/1.1" 500 12110
Internal Server Error: /favicon.ico
Traceback (most recent call last):
File "/usr/local/lib/python3.6/
response = get_response(request)
File "/usr/local/lib/python3.6/
response = self.process_request(reque
File "/usr/local/lib/python3.6/
host = self.redirect_host or request.get_host()
File "/usr/local/lib/python3.6/
if domain and validate_host(domain, allowed_hosts):
File "/usr/local/lib/python3.6/
if pattern == '*' or is_same_domain(host, pattern):
File "/usr/local/lib/python3.6/
pattern = pattern.lower()
AttributeError: 'ellipsis' object has no attribute 'lower'
"GET /favicon.ico HTTP/1.1" 500 12107
Then I went inside the file /usr/local/lib/python3.6/d
please see the implementation of is_same_domain I am not able find where the error is
def is_same_domain(host, pattern):
"""
Return ``True`` if the host is either an exact match or a match
to the wildcard pattern.
Any pattern beginning with a period matches a domain and all of its
subdomains. (e.g. ``.example.com`` matches ``example.com`` and
``foo.example.com``). Anything else is an exact string match.
"""
if not pattern:
return False
pattern = pattern.lower()
return (
pattern[0] == '.' and (host.endswith(pattern) or host == pattern[1:]) or
pattern == host
)
I am not able to find where the error is Please help in resolving this
With Many Thanks,
Bharath AK
ASKER
Hi Phill
I had checked the settings.py in the project directory it doesnot have ... text inside it.
With Many Thanks,
Bharath AK
I had checked the settings.py in the project directory it doesnot have ... text inside it.
With Many Thanks,
Bharath AK
ASKER
Hi Phill,
I am able to resolve this issue. I add print inside is_same_domain(host, pattern): before pattern.lower() then ran the applications.
I got three logs test_site, test_site2, eclipses. I had searched for test_site in my project folder
I got ALLOWED_HOSTS = ['test_site', 'test_site2', ...] in settings.py. I had missed the search in vim editor I had searched for /... in vi editor in settings.py but missed some how. Then what I did is removed ... and it started working.
Thank you so much.
With Many Thanks,
Bharath AK
I am able to resolve this issue. I add print inside is_same_domain(host, pattern): before pattern.lower() then ran the applications.
I got three logs test_site, test_site2, eclipses. I had searched for test_site in my project folder
I got ALLOWED_HOSTS = ['test_site', 'test_site2', ...] in settings.py. I had missed the search in vim editor I had searched for /... in vi editor in settings.py but missed some how. Then what I did is removed ... and it started working.
Thank you so much.
With Many Thanks,
Bharath AK
ASKER
Thanks Phill
Nice - glad you were able to find it!