Django
In this guide, we will discuss how to setup a Django project, that uses Onboardbase to manage its secrets(environment variables).
1. Install Onboardbase CLI
Follow the installation guide to set up Onboardbase CLI for your machine.
Verify installation with onboardbase --version
which would output the version of the CLI you just installed.
2. Authenticate Onboardbase CLI
From anywhere in your terminal, run onboardbase login
, and accept to open the page in a browser.
On the authorization page, enter your email, and a confirmation link would be sent to the email. Click on the link, and your CLI should be authorized. Check your terminal to confirm.
In staging and production, you'll need a service token to authenticate. Read more about service tokens and how to create one.
3. Setup Onboardbase CLI
After successful installation, from the Django Project directory in your terminal, run:
onboardbase setup
This would list all your projects, select the react project, select the development environment and accept to add .onboardbase.yaml to your .gitignore
file.
This would create an .onboardbase.yaml file that has all the details you selected during the setup and that would be used by the build script to know which secrets to pull into your django project.
4. Building with Onboardbase CLI
Since we have all our secrets on Onboardbase, we would be using the build tool from Onboardbase to load secrets into the project.
To do this, modify your start command:
python manage.py runserver
To this:
onboardbase run -c 'python manage.py runserver'
Notice how we now use onboardbase run to serve the project.
Awesome!
Updated 12 months ago