A basic Django app with postgres as database deployed on DigitalOcean (droplet) via Ansible.
Create a .env
file in the root of the cloned repository, with following variables:
POSTGRES_DB=sample
POSTGRES_USER=postgres
POSTGRES_PASSWORD="set strong password for postgres"
SUPERUSER_PASSWORD="set strong password for django admin dashboard"
DO_API_TOKEN="Digital Ocean token, if deploying"
To run the app install docker
and docker-compose
. Build and run the
app with following commands:
docker-compose build
docker-compose up
After running the commands above, the app should be running at: http://127.0.0.1:8000/
This is deployed on Digital Ocean Droplet via Ansible. To deploy run the
following command after docker-compose up
:
docker-compose exec web ansible-playbook deployment/site.yml