I want to connect to the database. I amadding cortrect mysql nhots. Please help me in connec ting the SQL databse tio my code

onkar-mehra
TRIAL

4 months ago

[2025-02-23 09:53:40 +0000] [1] [INFO] Starting gunicorn 23.0.0

[2025-02-23 09:53:40 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)

[2025-02-23 09:53:40 +0000] [1] [INFO] Using worker: sync

[2025-02-23 09:53:40 +0000] [9] [INFO] Booting worker with pid: 9

[2025-02-23 09:53:40 +0000] [9] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/opt/venv/lib/python3.12/site-packages/pymysql/connections.py", line 649, in connect
sock = socket.createconnection( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.nix-profile/lib/python3.12/socket.py", line 841, in createconnection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.nix-profile/lib/python3.12/socket.py", line 976, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/venv/lib/python3.12/site-packages/gunicorn/arbiter.py", line 608, in spawnworker worker.initprocess()
File "/opt/venv/lib/python3.12/site-packages/gunicorn/workers/base.py", line 135, in initprocess self.loadwsgi()
File "/opt/venv/lib/python3.12/site-packages/gunicorn/workers/base.py", line 147, in loadwsgi self.wsgi = self.app.wsgi() ^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.12/site-packages/gunicorn/app/base.py", line 66, in wsgi self.callable = self.load() ^^^^^^^^^^^ File "/opt/venv/lib/python3.12/site-packages/gunicorn/app/wsgi[app.py](app.py)", line 57, in load return self.loadwsgiapp()
^^^^^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.12/site-packages/gunicorn/app/wsgi[app.py](app.py)", line 47, in loadwsgiapp return util.importapp(self.appuri) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.12/site-packages/gunicorn/util.py", line 370, in importapp
mod = importlib.importmodule(module) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.nix-profile/lib/python3.12/importlib/init.py", line 90, in importmodule
return bootstrap.gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _findandload
File "", line 1331, in findandloadunlocked
File "", line 935, in loadunlocked
File "", line 995, in exec_module
File "", line 488, in _callwithframes_removed
File "/app/app.py", line 46, in
db = pymysql.connect(
^^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.12/site-packages/pymysql/connections.py", line 361, in init
self.connect()
File "/opt/venv/lib/python3.12/site-packages/pymysql/connections.py", line 716, in connect
raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'mysql.railway.internal' ([Errno -2] Name or service not known)")

View Deploy details

> ⓘ Deployment information is only viewable by project members and Railway employees.

0 Replies

I want to connect to the database. I amadding cortrect mysql nhots. Please help me in connec ting the SQL databse tio my code - Railway Help Station