Try Django 3.2
Learn the fundamentals behind one of the most popular web frameworks in the world by building a real project.
Learn the fundamentals behind one of the most popular web frameworks in the world by building a real project. Django has so many features that just work out of the box: user authentication, database management, html template rending, URL routing, form data validation, and so much more.
Django is a web-framework written in Python and runs the backend for many of the internet's most popular websites such as Instagram and Pinterest.
Reference code
Recommended Experience
- Basic HTML / CSS
- Python experience such as 30 Days of Python
discussions!
Need help? Found a bug? UseDeployment
doctl
Using-
Reference Post - https://kirr.co/usaoez
-
Sign up for DigitalOcean - https://do.co/cfe-youtube
-
Install doctl - https://kirr.co/dxcc48
-
Get API Token - https://kirr.co/7x8r90
-
Install the new token with:
doctl auth init --context main
--context main
is intensional here (it's used later).
- Clone Repo
git clone https://github.com/codingforentrepreneurs/Try-Django-3.2
- Change to your remote
git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
- In
.do/app.yaml
update each instance of
git:
branch: production-3
repo_clone_url: https://github.com/codingforentrepreneurs/Try-Django-3.2.git
to
github:
branch: production-3
deploy_on_push: true
repo: USERNAME/REPOSITORY
- Update ENV Secrets
In
.do/app.yaml
, you'll see theenvs
that includes values with thetype: SECRET
. You must use a plain-text value when you create this app.
So change:
- key: DJANGO_SECRET_KEY
scope: RUN_AND_BUILD_TIME
type: SECRET
value: EV[1:w8aaS/4qnhOJoLOQW4JnsmcjMQWF9Xfv:ZC08ZkUwFhkEzqXYlgtlwh260FWLbe6Zy+c0dqH4nyaqPFDKNF03wFs4D/51604nC0/xkOfDlHf+ldmkzyEsL68S]
To
- key: DJANGO_SECRET_KEY
scope: RUN_AND_BUILD_TIME
type: SECRET
value: wmu@re-x%d-kql&kzs(wo7@t%icu6d@140e0w!!oh^3q_yaw)w
- Create one-off secret keys with this guide
- Create app with
doctl
New to doctl?
doctl apps create --spec .do/app.yaml --context main --format "ID"
This will give you an app ID as a response. Something like
78457d4e6-53c2-43e4-afd1-97e701e1ab81
After it's is complete, we need to replace .do/app.yaml
to include the encypted keys reference:
- Get App Spec with
doctl
doctl apps spec get 78457d4e6-53c2-43e4-afd1-97e701e1ab81 > .do/app.yaml
The
78457d4e6-53c2-43e4-afd1-97e701e1ab81
is the id from the app created in step 10. Need to find the id? Usedoctl apps list --format "Spec.Name, ID"
- Commit & Push your code It's very important that you do step 11 prior to commiting any app.yaml code. (It is not important if you do not have keys you'd like to hide)
git add .do/app.yaml
git commit -m "Updated app.yaml SECRET keys"
git push origin main