Digital Ocean
Preflight
Stale
- Worked on Digital Ocean's App Platform
- Need
runtime.txt
- Push updated project to the github repository
- Haven't updated this in awhile
Create DO App
Create app with Step 1 / Choose Source: connect github repository.
Add Database
Scroll to the bottom of the wizard form of Step 2 / Configure your app , start with adding a database named db
. This is a Django project after all.
Name the database db
.
Set WSGI
Append config.wsgi to the default contained in Run Command
field of Step 2 / Configure your app:
Set Env
In Step 2 / Configure your app, the field for environment variables is empty. Set the following:
Key | Value | Description |
---|---|---|
DJANGO_ALLOWED_HOSTS |
${APP_DOMAIN} | This can be configured later hence the brackets |
DATABASE_URL |
${db.DATABASE_URL} | This assume that the DATABASE is named db |
DJANGO_SECRET_KEY |
Set your own | Preconfigure and toggle the "encrypt" checkbox on |
ENV_NAME |
test | Preconfigure and toggle the "encrypt" checkbox on |
Additionally, can add optional environment variables for social authentication IDs.
Add Details
On Next
, Step 3 / Name your web service:
- Select a name
- Add a data region
Build App
On Next
, Step 4 / Finalize and launch, select:
- The pricing plan
- Number of containers
Then Launch App
which will proceed to build the component.
Note that as part of auto-detecting python's requirement.txt
file and determining that it is a python / django application, the build process automatically runs the following command after "Installing requirements with pip":
This standard command places all static files - such as images, css, and js - in a single designated output directory previously set by config.settings.STATIC_ROOT
.
The build process normally takes a few minutes.
Initialize Database / Admin
Can now run commands in the console such as:
Setup Domain
- Let's assume previous purchase / control of a
samplesite.com
from NameCheap - Visit the
Settings
tab of the console - Click on
Edit
in theDomains
section - Click on
Add Domain
- Enter the domain in the field
- Choose
We manage your domain
- Secure Digital Ocean
nameservers
e.g.: - ns1.digitalocean.com
- ns2.digitalocean.com
- ns3.digitalocean.com
- Visit NameCheap's console related to the purchased
samplesite.com
- Add the nameservers
- DNS name changes can take up to 72 hours.
Visit Django Admin
- Use created
superuser
account to login tosamplesite.com/admin
- Change the domain name from
example.com
tosamplesite.com