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
This sample is a simple Django to-do app that uses SQLite as the database, which will be reset every time you deploy. **It is not production-ready**. For production use cases, you should check out the Django + Postgres sample.
6
6
7
7
The app includes a management command which is run on startup to create a superuser with the username `admin` and password `admin`. This means you can login to the admin interface at `/admin/` and see the Django admin interface without any additional steps. The `example_app` is already registered and the `Todo` model is already set up to be managed in the admin interface.
8
8
9
-
The Dockerfile and compose files are already set up for you and are ready to be deployed. Serving is done using [Gunicorn](https://gunicorn.org/) and uses [WhiteNoise](https://whitenoise.readthedocs.io/en/latest/) for static files. The `CSRF_TRUSTED_ORIGINS` setting is configured to allow the app to run on a `defang.dev` subdomain.
9
+
The compose files are already set up for you and are ready to be deployed and the image is built by [Railpack](https://railpack.com/). Serving is done using [Gunicorn](https://gunicorn.org/) and uses [WhiteNoise](https://whitenoise.readthedocs.io/en/latest/) for static files. The `CSRF_TRUSTED_ORIGINS` setting is configured to allow the app to run on a `defang.dev` subdomain.
2. (Optional) If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc) authenticate with your cloud provider account
15
-
3. (Optional for local development) [Docker CLI](https://docs.docker.com/engine/install/)
16
-
17
-
## Development
18
-
19
-
To run the application locally, you can use the following command:
20
-
21
-
```bash
22
-
docker compose up --build
23
-
```
24
15
25
16
## Configuration
26
17
27
-
For this sample, you will not need to provide [configuration](https://docs.defang.io/docs/concepts/configuration).
18
+
For this sample, you will not need to provide [configuration](https://docs.defang.io/docs/concepts/configuration).
28
19
29
20
If you wish to provide configuration, see below for an example of setting a configuration for a value named `API_KEY`.
30
21
@@ -40,6 +31,7 @@ defang config set API_KEY
40
31
### Defang Playground
41
32
42
33
Deploy your application to the Defang Playground by opening up your terminal and typing:
34
+
43
35
```bash
44
36
defang compose up
45
37
```
@@ -51,16 +43,16 @@ If you want to deploy to your own cloud account, you can use Defang BYOC:
51
43
1.[Authenticate your AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), and check that you have properly set your environment variables like `AWS_PROFILE`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY`.
52
44
2. Make sure to update the `CSRF_TRUSTED_ORIGINS` setting in the `settings.py` file to include an appropriate domain.
53
45
3. Run in a terminal that has access to your AWS environment variables:
54
-
```bash
55
-
defang --provider=aws compose up
56
-
```
46
+
```bash
47
+
defang --provider=aws compose up
48
+
```
57
49
58
50
---
59
51
60
52
Title: Django
61
53
62
54
Short Description: A simple Django app that uses SQLite as the database.
This is a basic Flask to-do app that can be deployed with Defang. Note that alongside your `.py` file, include a `requirements.txt` so that the Dockerfile can install the necessary packages with pip.
5
+
This is a basic Flask to-do app that can be deployed with Defang. Note that alongside your `.py` file, include a `requirements.txt` so that the [Railpack](https://railpack.com/) can install the necessary packages with pip.
6
6
7
7
This project is intended to provide a basic understanding of how to get started with Flask on Defang. The items are stored in memory and are lost when the server is restarted. **It is not intended for production use**. If you need something production ready, you should use a managed database like Postgres or MySQL.
2. (Optional) If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc) authenticate with your cloud provider account
13
-
3. (Optional for local development) [Docker CLI](https://docs.docker.com/engine/install/)
14
-
15
-
## Development
16
-
17
-
To run the application locally, you can use the following command:
18
-
19
-
```bash
20
-
docker compose up --build
21
-
```
22
13
23
14
## Configuration
24
15
25
-
For this sample, you will not need to provide [configuration](https://docs.defang.io/docs/concepts/configuration).
16
+
For this sample, you will not need to provide [configuration](https://docs.defang.io/docs/concepts/configuration).
26
17
27
18
If you wish to provide configuration, see below for an example of setting a configuration for a value named `API_KEY`.
28
19
@@ -38,6 +29,7 @@ defang config set API_KEY
38
29
### Defang Playground
39
30
40
31
Deploy your application to the Defang Playground by opening up your terminal and typing:
32
+
41
33
```bash
42
34
defang compose up
43
35
```
@@ -48,16 +40,16 @@ If you want to deploy to your own cloud account, you can use Defang BYOC:
48
40
49
41
1.[Authenticate your AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), and check that you have properly set your environment variables like `AWS_PROFILE`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY`.
50
42
2. Run in a terminal that has access to your AWS environment variables:
2. (Optional) If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc) authenticate with your cloud provider account
11
-
3. (Optional for local development) [Docker CLI](https://docs.docker.com/engine/install/)
12
-
13
-
## Development
14
-
15
-
To run the application locally, you can use the following command:
16
-
17
-
```bash
18
-
docker compose up --build
19
-
```
20
11
21
12
## Configuration
22
13
23
-
For this sample, you will not need to provide [configuration](https://docs.defang.io/docs/concepts/configuration).
14
+
For this sample, you will not need to provide [configuration](https://docs.defang.io/docs/concepts/configuration).
24
15
25
16
If you wish to provide configuration, see below for an example of setting a configuration for a value named `API_KEY`.
26
17
@@ -36,6 +27,7 @@ defang config set API_KEY
36
27
### Defang Playground
37
28
38
29
Deploy your application to the Defang Playground by opening up your terminal and typing:
30
+
39
31
```bash
40
32
defang compose up
41
33
```
@@ -46,16 +38,16 @@ If you want to deploy to your own cloud account, you can use Defang BYOC:
46
38
47
39
1.[Authenticate your AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), and check that you have properly set your environment variables like `AWS_PROFILE`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY`.
48
40
2. Run in a terminal that has access to your AWS environment variables:
49
-
```bash
50
-
defang --provider=aws compose up
51
-
```
41
+
```bash
42
+
defang --provider=aws compose up
43
+
```
52
44
53
45
---
54
46
55
47
Title: Go HTTP Form
56
48
57
49
Short Description: A simple Go application that demonstrates form submission using the net/http library.
A basic Next.js app with a Dockerfile and compose.yaml ready to deploy to AWS with[Defang](https://defang.io).
5
+
A simple Next.js app with a compose.yaml, ready to deploy to AWS using[Defang](https://defang.io). The container image is automatically built by [Railpack](https://railpack.com/).
6
6
7
7
## Steps
8
8
@@ -11,29 +11,12 @@ A basic Next.js app with a Dockerfile and compose.yaml ready to deploy to AWS wi
11
11
3. (optional) [Authenticate with AWS](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)
12
12
4. Run `defang compose up` in the root of this project
13
13
14
-
## Static Files (Experimental)
15
-
16
-
This example supports deployment to AWS as a static site. Static files will be copied to an S3 bucket. In the _affordable_
17
-
deployment mode (the default), the static files will be served over HTTP from an S3 bucket.
18
-
19
-
:::info
20
-
Note that some top-level domains (TLDs), such as `.app`, require HSTS, which will disallow browsers from accessing the site over HTTP. If you want to use such a TLD, you must serve the static files over HTTPS by using either the _balanced_ or _high_availability_ deployment mode.
21
-
:::
22
-
23
-
To serve the static files over HTTPS, use either the _balanced_ or _high_availability_ deployment mode, which will create a CloudFront distribution in front of the S3 bucket.
24
-
25
-
To deploy this project as a static site, run:
26
-
27
-
```bash
28
-
defang compose up -f compose.static.yaml --provider=aws --mode=balanced
This sample shows how to get a simple React app up and running with Defang.
6
-
It includes Vite and ESLint, which are common build tools for React development.
5
+
This sample shows how to get a simple React app up and running with Defang.
6
+
It includes Vite and ESLint, which are common build tools for React development. The container image is automatically built by [Railpack](https://railpack.com/).
2. (Optional) If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc) authenticate with your cloud provider account
12
-
3. (Optional for local development) [Docker CLI](https://docs.docker.com/engine/install/)
13
12
14
13
## Development
15
14
@@ -20,12 +19,6 @@ npm install
20
19
npm run dev
21
20
```
22
21
23
-
To run it using a Docker container, you can use the following command:
24
-
25
-
```bash
26
-
docker compose up --build
27
-
```
28
-
29
22
## Deployment
30
23
31
24
> [!NOTE]
@@ -34,6 +27,7 @@ docker compose up --build
34
27
### Defang Playground
35
28
36
29
Deploy your application to the Defang Playground by opening up your terminal and typing:
30
+
37
31
```bash
38
32
defang compose up
39
33
```
@@ -44,16 +38,16 @@ If you want to deploy to your own cloud account, you can use Defang BYOC:
44
38
45
39
1.[Authenticate your AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), and check that you have properly set your environment variables like `AWS_PROFILE`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY`.
46
40
2. Run in a terminal that has access to your AWS environment variables:
47
-
```bash
48
-
defang --provider=aws compose up
49
-
```
41
+
```bash
42
+
defang --provider=aws compose up
43
+
```
50
44
51
45
---
52
46
53
47
Title: React
54
48
55
-
Short Description: A minimal React app running on Defang.
49
+
Short Description: A minimal React app running on Defang.
0 commit comments