You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -4,84 +4,203 @@ description: How to deploy Django to App Plaform by Digital Ocean
4
4
5
5
# App Platform - Deploy Django
6
6
7
-
<SubHeadingcolor="#25c2a0">How to deploy Django to App Plaform by Digital Ocean</SubHeading>
7
+
<SubHeadingcolor="#25c2a0">How to deploy Django to App Platform by Digital Ocean</SubHeading>
8
8
9
-
@Todo - General information AWS Platform
9
+
DigitalOcean is a cloud infrastructure provider that offers a variety of products to help developers and businesses deploy and manage their applications. One of its key offerings is the App Platform, which simplifies the process of deploying and scaling web applications. With App Platform, users can deploy code directly from their Git repositories and choose from pre-configured language and database options, making it easy to get started without worrying about infrastructure management.
10
10
11
11
> Topics covered
12
12
13
-
-`App Plaform` Account Creation
14
-
-`App Plaform` Account Settings
13
+
-`App Platform` Account Creation
15
14
- The project to be deployed
16
-
-`App Plaform` Database set up
17
-
-`App Plaform` Environment set up
18
-
-`App Plaform` Domain settings
19
-
-`App Plaform` SSL certificates
20
-
-`App Plaform` CI/CD from Github
21
-
-`App Plaform` LIVE Service monitoring
15
+
-`App Platform` Setting up project
16
+
-`App Platform` Deploying the application
17
+
-`App Platform` LIVE Service monitoring
22
18
23
-
\
19
+
## `App Platform` Account Creation
24
20
25
-
## `App Plaform` Account Creation
21
+
If you want to use the DigitalOcean App Platform to deploy your app, you'll need to create a DigitalOcean account. Here are the steps to get started:
26
22
27
-
@Todo: Step by step presentation
23
+
1. Go to DigitalOcean home page at https://www.digitalocean.com/.
24
+
2. You can directly sign up from button in the hero section or click "Sign up" at the top right corner of the page.
25
+
3. Select your preferred sign up method, you can sign up using Google, Github, or email.
26
+
4. Fill out the survey form, which asks a few questions about your project needs, and then click "Submit".
27
+
5. You will be prompted to set a payment method to verify your identity. Choose your desired payment method and fill out the form provided. If you choose payment with a card, make sure you have at least $1 for the verification. It will be refunded within a few days.
28
+
6. After you have verified, create a project to start using DigitalOcean.
6. Add `dj-database-url` to the `requirements.txt` file.
123
+
124
+
7. Commit your changes and push the revision to Github.
125
+
126
+
## `App Platform` Deploying the application
127
+
128
+
DigitalOcean's App Platform is a service that allows you to easily deploy your web applications. In this tutorial, we'll go over the steps to deploy an application on the App Platform.
129
+
130
+
### Setting up the app
131
+
132
+
1. Go to https://cloud.digitalocean.com/apps and click on "Create App". This will take you to a page where you can choose your service provider. For this demo, we'll choose GitHub.
133
+
134
+
2. Click on "Manage Access". You'll be prompted to connect your GitHub account. Connect your account and allow DigitalOcean to access your repositories.
135
+
136
+
3. Select the repository you want to deploy, choose the branch and source directory, and click "Next".
137
+
138
+
4. Click "Edit" next to the app to configure your app.
40
139
41
-
\
140
+
5. Edit the "Run Command", change it to the following command, then click "Save":
42
141
43
-
## `App Plaform` Database set up
142
+
```bash
143
+
gunicorn --worker-tmp-dir /dev/shm core.wsgi
144
+
```
44
145
45
-
@Todo:
146
+
6. Click "Edit" next to "HTTP Request Routes" and change "Routes" to `/`, then save and click "Back" to go back to the resource page.
46
147
47
-
- How to set up a PostgreSQL database + user credentials
48
-
- How to set up a MySql database + user credentials
148
+
### Adding resources
49
149
50
-
\
150
+
1. Click "Edit" next to "Add Resource" and select "Database". Enter your database name and click "Add".
151
+
2. Click "Add Resource" again, select "Detect from Source Code" to set up the static file, and select the same repository as in the previous step.
152
+
3. Click "Edit" next to the new resource, change the configuration to the following, then save and click "Back":
153
+
- Name: static (or anything else)
154
+
- Resource Type: Static Site
155
+
- Output Directory: staticfiles
156
+
- HTTP Request Routes: /static
157
+
4. Click "Next" to set up environment variables.
51
158
52
-
##`App Plaform` Environment set up
159
+
### Setting up environment variables
53
160
54
-
@Todo:
161
+
1. Click "Edit" next to the your app name, then add these variables.
55
162
56
-
- How to specify the Python version to be used
57
-
- How to set the environment variables used by the app
-`SECRET_KEY`: enter your secret key and check "Encrypt"
166
+
-`DEBUG`: True (set to False when your app is running properly)
167
+
2. Click "Save" and then click "Next".
58
168
59
-
\
169
+
### Configuring app information
60
170
61
-
## `App Plaform` Domain settings
171
+
1. If you want to set a name for your app and select the project, click "Edit" under "App Info"
172
+
2. If you want to choose the server region, click "Edit" under "Region". Choose the region nearest to your location.
173
+
3. Click "Next" to continue the process.
62
174
63
-
@Todo: How to park a domain or a subdomain to the service
175
+
### Deploying your app
64
176
65
-
\
177
+
1. Review your configuration, then click "Create Resources" at the bottom of the page when you are sure.
66
178
67
-
## `App Plaform` SSL certificates
179
+
2. Once the build process completes, go to "Console" tab and run the following commands.
68
180
69
-
@Todo: How to enhance the service with valid certificates (not self signed)
181
+
```bash
182
+
python manage.py migrate
183
+
python manage.py createsuperuser
184
+
```
70
185
71
-
\
186
+
Congratulations, your application is now deployed on DigitalOcean App Platform!
72
187
73
-
## `App Plaform` CI/CD from Github
188
+
## `App Platform` LIVE Service monitoring
74
189
75
-
@Todo: This section explains how to link an automatic deploy from Github on new commits
190
+
We'll use UptimeRobot to monitor the app. UptimeRobot is a popular online service that monitors the uptime and performance of websites, servers, and other online services.
76
191
77
-
\
192
+
Go to [UptimeRobot](https://uptimerobot.com/) create an account or sign in if you already have account. Create monitor by clicking "Add New Monitor" button then follow this config:
78
193
79
-
## `App Plaform` LIVE Service monitoring
194
+
- Monitor Type: HTTP(s)
195
+
- Friendly Name: django-AWS (or anything else you want)
196
+
- URL (or IP): your_domain
80
197
81
-
@Todo: How to check out the service health and uptime
198
+
Keep the rest of the config as default and click "Create Monitor"
82
199
83
-
\
200
+
UptimeRobot will now start monitoring your app. You can view the monitor status and performance data on the UptimeRobot dashboard
84
201
85
202
## Links & Resources
86
203
87
-
@Todo: mention at least two valuable resources (articles or docs)
204
+
- 👉 More [Django Starters](https://appseed.us/apps/django/) - provided by `AppSeed` (free & paid)
205
+
- 👉 Free [Support](https://appseed.us/support/) via Email & Discord
206
+
-[Django](https://docs.djangoproject.com/en/4.2/releases/4.2) official documentation
0 commit comments