a year ago
I linked the backend service, I put the variables in be service and also on my local . i try to connect using this
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ.get('PGDATABASE'),
'USER': os.environ.get('PGUSER'),
'PASSWORD': os.environ.get('PGPASSWORD'),
'HOST': os.environ.get('PGHOST'),
'PORT': os.environ.get('PGPORT'),
}
}
i run command railway run python manage.py migrate ( after i did the makemigrations i have the tables on db service) and i get …
…
etc
django.db.utils.OperationalError: [Errno 11001] getaddrinfo failed
37 Replies
a year ago
I think you are looking for railway ssh -- python manage.py migrate
Hi.
(env) PS C:\Users\toshd\Licenta - Copy (4)Chinezu\licentaRepo\backend> railway ssh -- python manage.py migrate
Traceback (most recent call last):
File "/app/manage.py", line 11, in main
from django.core.management import executefromcommand_line
ModuleNotFoundError: No module named 'django'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/manage.py", line 22, in
main()
File "/app/manage.py", line 13, in main
raise ImportError(
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
(env) PS C:\Users\toshd\Licenta - Copy (4)Chinezu\licentaRepo\backend>
with my env on
From what i know from previous ticket one year ago railway run did the work
a year ago
railway run runs the command locally
a year ago
I think - railway ssh -- source venv/bin/activate && python manage.py migrate
(env) PS C:\Users\toshd\Licenta - Copy (4)Chinezu\licentaRepo\backend> railway ssh
Connected to interactive shell
root@bc6e63292d7d:/app#
root@bc6e63292d7d:/app# source env/bin/activate
bash: env/bin/activate: No such file or directory
root@bc6e63292d7d:/app# .\env\Scripts\Activate.ps1
bash: .envScriptsActivate.ps1: command not found
root@bc6e63292d7d:/app# ls
accounts dashboardcron manage.py requirements.txt api db.sqlite3 outputtest.csv templates
api_payments dreptapp railway.json
root@bc6e63292d7d:/app#
i entered on the service and it says Assign it the following value:
${{ peDreptDB.DATABASE_URL }}
3
Use the variable in your application code.
a year ago
railway ssh. /opt/venv/bin/activatepython manage.py migrate
but python manage.py didn't
a year ago
remove the start command from the railway.json file please
a year ago
the json line itself
same thing
i did a project one year ago, 1 fe 1 be and i followed the instructions on that ticket (maybe i missed something) and it was railway login , link , shell , activated the venv then did the migrations
a year ago
made some changes, lets see how those work
a year ago
please dont
a year ago
you're all good, theres no need to run anything yourself anymore


a year ago
!s
Status changed to Solved brody • 12 months ago