Modify build command

How would I modify the build command so it does a pip install of psycopg2 ? I was told to remove that package from my requirements.txt and only use it to connect to the postgres db in production.
11 Replies
Percy
Percyโ€ข14mo ago
Project ID: 3b4c3c14-6b11-4e8a-8f52-bb11ff2f2554
intro ๐Ÿ‡ฎ๐Ÿ‡น
3b4c3c14-6b11-4e8a-8f52-bb11ff2f2554
Brody
Brodyโ€ข14mo ago
you put that package in your requirements.txt file and railway's default install command will install all the packages listed in that file if this is something chatgpt told you, I would recommend stackoverflow instead
intro ๐Ÿ‡ฎ๐Ÿ‡น
no i asked my former teacher and he said this: "you do not want to use psycopg2 in development its doesn't play nice with an M1, and we only need to to connect to a postgres db, so by installing it separately in production only, we kind of protect ourselves from accidentally installing it in dev"
Brody
Brodyโ€ข14mo ago
would you not need psycopg2 to connect to the railway database locally so you can run migrations and seed it?
intro ๐Ÿ‡ฎ๐Ÿ‡น
i don't think so. he was specifically talking about the postgres instance locally is sqlite
Brody
Brodyโ€ข14mo ago
yes but you need to run migrations/seeds on the railway postgres instance too
intro ๐Ÿ‡ฎ๐Ÿ‡น
i have to use the railway cli in order to do that so ideally, build command would install requirements, install psycopg2 and do flask upgrade and seed
Brody
Brodyโ€ข14mo ago
yes you do, but like I've said, that command is ran on your own computer, thus you need to be able to connect to postgres from your own computer ideally you would do the migration and seed from your computer also python apps don't really have a build command, you are thinking about nodejs
intro ๐Ÿ‡ฎ๐Ÿ‡น
so i was able to deploy my project with database on render i really wanted to try railway but it's just giving me too many issues rn
Brody
Brodyโ€ข14mo ago
railway deploys your code as is render has been known to do little monkeypatches to get code to run properly
Want results from more Discord servers?
Add your server