Hi, im wondering about deploy a django app that i’ve written. i have no experience doing this, i had deployed on render but i did a mess with my code, i did 2 github repositories one for the localhost and another one for the production and i dont know how to have these 2 enviroments, any suggestion? My idea is to deploy on a digitalocean droplet. my stack is django, postgres (i have a remote db), and celery with redis via docker. Any sugestion on how to be able to deploy and have the two configurations properly done?
First, you want to ensure that you never check your settings file into github with any kind of secret embedded it in. Your settings file should not actually contain your secret key, database password, or anything else that shouldn’t be made public.
A lot of people use either environment variables or environment files or external settings files on the machine(s) being deployed to.
If the only difference between your “local” and “production” deployments are in the settings, this allows you to only have one repo. You then create the appropriate environment settings for each target, outside your project.
See How to deploy Django | Django documentation | Django and Deployment checklist | Django documentation | Django for some more specific information as to the different issues involved with deployment that you should address.