Vitalii Mytenko
Vitalii Mytenko

Reputation: 772

How to run commands in CLI with Railway.app

I have Django project deployed to Railway.app. I've installed Railway CLI, but can't understand how to run python manage.py makemigrations and so on in its CLI to make Django runnig.

My laptop is running Windows 10 Home.

Ho do I?

UPDATE. Some results from the answers:

In settings.py use Railway's DB. In this case you don't need to run CLI commands via Railway CLI, you may use local and it will affect the Railway's DB.

  1. In case you are using dev DB, that is different from Railway's linked to project.
  2. railway login
  3. railway link your_railway's_project_Id
  4. railway status to check whether you are in the right project
  5. railway run python manage.py createsuperuser
  6. This will affect Railways's DB

railway run python manage.py collectstatic make migrations migrate still don't run on remote server.

In Procfile I used code:

web: python manage.py migrate && gunicorn project_name.wsgi

Upvotes: 7

Views: 10943

Answers (2)

Baldráni
Baldráni

Reputation: 5640

So, you should run IN YOUR PROJECT REPOSITORY :

  • railway link -> Then select your project
  • railway run <your command>

Upvotes: 3

Victor Joseph
Victor Joseph

Reputation: 39

you can do that by using railway run (command to be executed)

for example to create a superuser, use railway run python manage.py createsuperuser

Check out this article

PS: Ensure you are in the same directory as that of the production because it will run both on local and production environment.

Upvotes: 3

Related Questions