How to add the start command
ndhlovu1
TRIALOP

2 years ago

I keep trying to deploy a simple django project. I keep getting the error of not having a start command. I have also built several projects with pipenv and I would like to know how to get these to run successfully as well.

View Deploy details

ⓘ Deployment information is only viewable by Project members and Railway admins.

29 Replies

2 years ago

You would want to have a railway.json file, here's an example of that -

https://github.com/railwayapp-templates/django/blob/main/railway.json


ndhlovu1
TRIALOP

2 years ago

Am I able to add custom commands such as cd


2 years ago

I have yet to see a legitimate use case for doing cd in start commands, whenever I've seen it done there has always been a better way.

So please tell me your use case.


ndhlovu1
TRIALOP

2 years ago

in my case, I am using pipenv soo, the procedure can be something like

  1. pipenv install : this is the equivalent of installing requirements

2. It is also used to create the virtual environment

so, the command to use would be : pip install pipenv
then : pipenv install , this will be to install from the Pipfile.lock


2 years ago

Yep that all sounds good, where does the need for cd come into play?


ndhlovu1
TRIALOP

2 years ago

It was just an example


ndhlovu1
TRIALOP

2 years ago

So where would be an ideal place to include the different commands needed for deployment, and are there specific key names I should use


2 years ago

Nixpacks should pick up on the Pipfile by default and run all the needed commands for you during the build.

https://nixpacks.com/docs/providers/python#install


ndhlovu1
TRIALOP

2 years ago

Also for the cd, because I do have a file that is having the 2 directories, one with the project and another from with documentation on my git, how can i add such a command to search in the nix directory


2 years ago

As mentioned, cd is likely being misused here, are you able to share your repo so I can give better advice on this topic?



2 years ago

If your app needs the markdown files in the Documentation folder you should have that folder on the directory level as the rest of your app, you have your app in an AMSProject folder meaning that's what you'd also want to set the railway service's root directory to.


ndhlovu1
TRIALOP

2 years ago

Yea, the other folder simply isnt being read. However, I have found great value in the link you sent.

Also, do i add these "PIPENVVENVIN_PROJECT=1 pipenv install --deploy" as environment variables?


2 years ago

Nope that's done automatically by nixpacks.


ndhlovu1
TRIALOP

2 years ago

Whoaa, thats awesome!


ndhlovu1
TRIALOP

2 years ago

Hi,

It has successfully been built, however I currently cant access the app it keeps saying there's nothing here yet.

This is the link.
https://alumni-management-system-production.up.railway.app/


2 years ago

I get bad request 400.


ndhlovu1
TRIALOP

2 years ago

Yea, I just loaded and I also received the same error, any ideas what may be wrong


2 years ago

This is a code and or config issue, check your deploy logs.


ndhlovu1
TRIALOP

2 years ago

is there a way to verify if the django server was started

My logs, seem ok, but I had seen a message about the makemigrations and migrate message before the logs succeeded

Attachments


2 years ago

is there a way to verify if the django server was started

Yes, check your deploy logs.


ndhlovu1
TRIALOP

2 years ago

I have found its :
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

Where can I run this command

Attachments


2 years ago

I had answered that question in my very first comment.


ndhlovu1
TRIALOP

2 years ago

Hahaha, yea, my bad thanks for the reminder.


ndhlovu1
TRIALOP

2 years ago

I managed, to get it to show a different error, the error, I am now getting is :

I got a message that the server didnt respond first then the 400 Bad Request


2 years ago

This is a code and or config issue, check your deploy logs.


ndhlovu1
TRIALOP

2 years ago

Cool, lemme try setting up a separate project


ndhlovu1
TRIALOP

2 years ago

Hi, Hi

I am getting an error "python: can't open file 'manage.py': [Errno 2] No such file or directory" and I currently have no idea, what I have done wrong or rather how to resolve this error.

It is showing that the deployment completed successfully however.



Loading...