Cannot connect to localhost when running Django - macos

I am trying to run my Django project and I encountered the following problem:
^C(venv) tests-MacBook-Pro-2:hearinsights morganlai$ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
Unhandled exception in thread started by <function wrapper at 0x103fc46e0>
Traceback (most recent call last):
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
self.check_migrations()
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 163, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__
self.loader = MigrationLoader(self.connection)
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/db/migrations/loader.py", line 49, in __init__
self.build_graph()
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/db/migrations/loader.py", line 176, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations
self.ensure_schema()
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 52, in ensure_schema
if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/db/backends/base/base.py", line 231, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/db/backends/base/base.py", line 204, in _cursor
self.ensure_connection()
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection
self.connect()
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/db/utils.py", line 95, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection
self.connect()
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/db/backends/base/base.py", line 171, in connect
self.connection = self.get_new_connection(conn_params)
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/django/db/backends/postgresql/base.py", line 175, in get_new_connection
connection = Database.connect(**conn_params)
File "/Users/morganlai/Desktop/hearinsights-heap/venv/lib/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory, async=async)
django.db.utils.OperationalError: could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
I have tried to start and restart the postgres database following the instructions here: How to start PostgreSQL server on Mac OS X?
After restart the server, the problem still occured:
tests-MacBook-Pro-2:hearinsights morganlai$ pg_ctl -D /usr/local/var/postgres stop -s -m fast
pg_ctl: PID file "/usr/local/var/postgres/postmaster.pid" does not exist
Is server running?
tests-MacBook-Pro-2:hearinsights morganlai$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
server starting
I would encounter this problem every single time when I restarted my mac and the solution provided by that article usually worked in the past. Since it is not working this time, I wonder it might be some other problems.

Try to uninstall the current postgres files. And install it from scratch using homebrew:
https://launchschool.com/blog/how-to-install-postgresql-on-a-mac
This might fix your issue.

Related

Run docker-compose with podman as a backend on MacOS

I am trying to run docker-compose CLI with podman backend on my local machine (MacOS). Here is what I did:
Install podman using brew: brew install podman
Initialize the podman machine: podman machine init
Started the machine: podman machine start
Running podman version gives me this:
Client:
Version: 3.4.4
API Version: 3.4.4
Go Version: go1.17.6
Built: Wed Dec 8 19:41:11 2021
OS/Arch: darwin/amd64
Server:
Version: 3.4.4
API Version: 3.4.4
Go Version: go1.16.8
Built: Wed Dec 8 22:45:07 2021
OS/Arch: linux/amd64
I created a symlink for podman (ln -s podman docker), so running docker version gives me the same and I can actually run containers using docker run even though docker is not installed.
Afterwards I installed docker-compose using:
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose version gives me this:
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1h 22 Sep 2020
Problem is that docker-compose up test is not working as docker-compose doesn't seem to find the docker host to connect to or is somehow blocked, does somebody know how to solve this issue:
Traceback (most recent call last):
File "urllib3/connectionpool.py", line 670, in urlopen
File "urllib3/connectionpool.py", line 392, in _make_request
File "http/client.py", line 1255, in request
File "http/client.py", line 1301, in _send_request
File "http/client.py", line 1250, in endheaders
File "http/client.py", line 1010, in _send_output
File "http/client.py", line 950, in send
File "docker/transport/unixconn.py", line 43, in connect
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "requests/adapters.py", line 439, in send
File "urllib3/connectionpool.py", line 726, in urlopen
File "urllib3/util/retry.py", line 410, in increment
File "urllib3/packages/six.py", line 734, in reraise
File "urllib3/connectionpool.py", line 670, in urlopen
File "urllib3/connectionpool.py", line 392, in _make_request
File "http/client.py", line 1255, in request
File "http/client.py", line 1301, in _send_request
File "http/client.py", line 1250, in endheaders
File "http/client.py", line 1010, in _send_output
File "http/client.py", line 950, in send
File "docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "docker/api/client.py", line 214, in _retrieve_server_version
File "docker/api/daemon.py", line 181, in version
File "docker/utils/decorators.py", line 46, in inner
File "docker/api/client.py", line 237, in _get
File "requests/sessions.py", line 543, in get
File "requests/sessions.py", line 530, in request
File "requests/sessions.py", line 643, in send
File "requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose/cli/main.py", line 81, in main
File "compose/cli/main.py", line 200, in perform_command
File "compose/cli/command.py", line 60, in project_from_options
File "compose/cli/command.py", line 152, in get_project
File "compose/cli/docker_client.py", line 41, in get_client
File "compose/cli/docker_client.py", line 170, in docker_client
File "docker/api/client.py", line 197, in __init__
File "docker/api/client.py", line 221, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
[63757] Failed to execute script docker-compose
Did you install podman-mac-helper?
sudo /opt/homebrew/Cellar/podman/4.0.2/bin/podman-mac-helper install
docker-compose v2.3.4 works just fine with Podman v4.0.2 on a MacBook Pro M1 running macOS Monterey as long as you install podman-mac-helper (which makes /var/run/docker.sock available.)

VirtualBox anaconda installation failing

Having trouble installing anaconda on my Ubuntu VirtualBox. Have tried rebooting and have tried assigning a bigger chunk of base memory but still failing at the final few hurdles.
Unpacking payload ...
concurrent.futures.process._RemoteTraceback:
'''
Traceback (most recent call last):
File "concurrent/futures/process.py", line 368, in _queue_management_worker
File "multiprocessing/connection.py", line 251, in recv
TypeError: __init__() missing 1 required positional argument: 'msg'
'''
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "entry_point.py", line 69, in <module>
File "concurrent/futures/process.py", line 484, in _chain_from_iterable_of_lists
File "concurrent/futures/_base.py", line 611, in result_iterator
File "concurrent/futures/_base.py", line 439, in result
File "concurrent/futures/_base.py", line 388, in __get_result
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or
pending.
[1981] Failed to execute script entry_point

Internal server error while installing odoo 10 in windows 10

I am facing this problem while installing odoo 10 in windows. This error occurs while running odoo 10 in browser. I have seen log file and it gives an error
Traceback (most recent call last):
File "werkzeug\serving.py", line 177, in run_wsgi
File "werkzeug\serving.py", line 165, in execute
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\service\server.py", line 249, in app
return self.app(e, s)
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\service\wsgi_server.py", line 186, in application
return application_unproxied(environ, start_response)
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\service\wsgi_server.py", line 172, in application_unproxied
result = handler(environ, start_response)
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 1308, in __call__
return self.dispatch(environ, start_response)
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 1282, in __call__
return self.app(environ, start_wrapped)
File "werkzeug\wsgi.py", line 579, in __call__
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 1446, in dispatch
self.setup_db(httprequest)
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 1368, in setup_db
httprequest.session.db = db_monodb(httprequest)
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 1530, in db_monodb
dbs = db_list(True, httprequest)
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 1498, in db_list
dbs = odoo.service.db.list_dbs(force)
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\service\db.py", line 333, in list_dbs
with closing(db.cursor()) as cr:
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\sql_db.py", line 635, in cursor
return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized)
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\sql_db.py", line 177, in __init__
self._cnx = pool.borrow(dsn)
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\sql_db.py", line 518, in _locked
return fun(self, *args, **kwargs)
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\sql_db.py", line 586, in borrow
**connection_info)
File "psycopg2\__init__.py", line 164, in connect
OperationalError: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Can anyone help on this?
The error you're getting appears to be from Postgres not currently running, rather than an authentication error as you're presumed. The PSQL client or whatever PG client you're using is attempting to establish a connection on the default port but nothing is there.
If Postgres isn't currently running, try finding it (Via CTRL-Alt-Delete). If it's running, try terminating it and starting it up again. Hopefully that fixes the problem... Otherwise your port 5432 might be blocked for some reason.
If all fails, I am still skeptical the parentheses could cause this error because it's not an authentication error. Try to reinstall Postgres with a clean install.
Or you can get all port open in windows by using netstat -an in cmd
I am answering this again because I recently faced this issue which says "Internal server error" with odoo 11 using in windows 10.
This is because either odoo service or postgres service is not running. Now what we need to do is:
Go to Search in windows, which can be accessed via right click on windows symbol on the bottom left corner of the screen.
Search for services. You can see a services settings on searching for services. Click on it.
Now inside services, search for odoo service. Click on it. You will get 3 option. i,e to a. Start, b. stop & c. restart. on the left tab of window.
Click on restart. Wait until it says running.
Repeat steps 3 & 4 for postgres service.
Hope it helps to someone who face this issue in future.
To solve the problem, you must first install pgAdmin and create the user you specified during flectra installation. Then, you must grant all privileges on the user that it creates. Use tabs for assign access and set password.
You can find more detailed information in the following video:
https://www.youtube.com/watch?v=5XiwEi92hgQ

Ambari error during installation yarn

i'm trying to install IBM Open Platform 4.1 on Linux RedHat6; i created local repository for IOP and IOP-UTILS, because of proxy that block connection to ibm.
I installed ambari correctly but during installation of all packages i get this error:
1
File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 70, in inner
result = function(command, **kwargs)
File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 92, in checked_call
tries=tries, try_sleep=try_sleep)
File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 140, in _call_wrapper
result = _call(command, **kwargs_copy)
File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 291, in _call
raise Fail(err_msg)
resource_management.core.exceptions.Fail: Execution of '/usr/bin/yum -d 0 -e 0 -y install 'hadoop_4_1_*-yarn'' returned 1.
Error: Nothing to do

using rabbitmqadmin to access CloudAMQP / Heroku

I'm starting out to learn about AMQP and RabbitMQ.
To get myself going I have used a CLI tool, rabbitmqadmin, to successfully publish data to a RabbitMQ development install I have created upon my Mac OS X box. So far so good, I can publish messages, and watch them dequeue...
However when I come to try the exact same functionality upon the Heroku / CloudAMQP instance the rabbitmqadmin client seems to fall over.
This is the call:
rabbitmqadmin --host lemur.cloudamqp.com --vhost app4444444_heroku.com --user app4444444_heroku.com --password <withheld> publish routing_key=test payload="hello"
...and this is the output:
Traceback (most recent call last):
File "/usr/local/bin/rabbitmqadmin", line 828, in <module>
main()
File "/usr/local/bin/rabbitmqadmin", line 325, in main
method()
File "/usr/local/bin/rabbitmqadmin", line 428, in invoke_get
result = self.post(uri, json.dumps(upload))
File "/usr/local/bin/rabbitmqadmin", line 354, in post
return self.http("POST", path, body)
File "/usr/local/bin/rabbitmqadmin", line 377, in http
resp = conn.getresponse()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1013, in getresponse
response.begin()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 402, in begin
version, status, reason = self._read_status()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 366, in _read_status
raise BadStatusLine(line)
httplib.BadStatusLine: ''
Any thoughts or ideas gratefully received!
Add --ssl to the command line. CloudAMQP's web ui is https only.

Resources