iwHiteRabbiT
Putting Django migrate & collectstatic on Build CMD
While trying to solve my odd mem issue when deploying my Django app, I experimented and put migration & collectstatic at the building stage.
This seems to work correctly, solves the mem issue and solve the long restart issue too.
Which is great but I'm not sure of what are the implications of my changes, actually why does the collectstatic works at this stage?
Shouldn't this be working only after docker run and image publishing?
If someone could explain ^^
Here's the full config:
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "python manage.py migrate && python manage.py collectstatic --noinput",
"watchPatterns": [
"backend/**"
]
},
"deploy": {
"numReplicas": 1,
"startCommand": "gunicorn backend.wsgi",
"healthcheckPath": "/health",
"sleepApplication": true,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
14 replies