Skip to content

Commit 02857e1

Browse files
SamyOubouazizthomas-tacquetRoRoJ
authored
feat(srv): add doc on how to deploy website MTA-6545 (#5596)
* feat(srv): add doc on how to deploy website MTA-6545 * feat(srv): update * feat(srv): update * feat(srv): update * feat(srv): update * feat(srv): update * feat(srv): update * feat(srv): update * feat(srv): update * feat(srv): update * feat(srv): update * feat(srv): update * feat(srv): update * feat(srv): update * Apply suggestions from code review Co-authored-by: Thomas TACQUET <[email protected]> * Apply suggestions from code review Co-authored-by: Rowena Jones <[email protected]> --------- Co-authored-by: Thomas TACQUET <[email protected]> Co-authored-by: Rowena Jones <[email protected]>
1 parent a277d3a commit 02857e1

File tree

8 files changed

+621
-8
lines changed

8 files changed

+621
-8
lines changed

pages/account/reference-content/use-case-informational-website.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Hosting an informational website
33
description: Learn about the different ways to deploy an informational website (blog, portfolio, showcase) with Scaleway.
44
tags: use-case informational-website website blog portfolio showcase
55
dates:
6-
validation: 2025-05-15
6+
validation: 2025-10-08
77
posted: 2025-05-15
88
---
99

@@ -16,6 +16,7 @@ Your informational website can be based on several different architectures, that
1616
| Based on Object Storage | Cost-effective and highly available, suitable for static content. | Limited to serving static files, no server-side processing. |
1717
| Based on Web Hosting | Easy to set up and manage, suitable for small to medium websites. | Less control over the environment, can be limited in terms of customization. |
1818
| Based on Instances | Full control over the server environment, suitable for complex applications. | More complex setup and management, potentially higher costs. |
19+
| Based on Serverless Containers | Easy to deploy, scalable performance and cost, for static and dynamic websites. | Limited control over underlying hardware. |
1920
| Based on Elastic Metal (Aluminium) and Flexible IPs | Dedicated physical resources and high performance, suitable for demanding applications. | Higher costs, requires more technical expertise to manage. |
2021

2122
<Message type="note">
@@ -72,6 +73,18 @@ Hosting using Instances is a solution suited for users familiar with Unix operat
7273

7374
5. (Optional) Edit your WordPress settings to add your domain name.
7475

76+
## Hosting a website using Serverless Containers
77+
78+
1. [Register a domain name](/domains-and-dns/quickstart/#how-to-register-an-internal-domain/). Scaleway Domains and DNS allows you to manage and register your internal and external domains and configure and manage their DNS zones.
79+
80+
2. Containerize your application, then build and [push its image to the Scaleway Container Registry](/serverless-containers/how-to/build-push-container-image/).
81+
82+
3. [Deploy a Serverless Container](/serverless-containers/how-to/deploy-container/) based on your app image.
83+
84+
4. [Add a custom domain to your container](/serverless-containers/how-to/add-a-custom-domain-to-a-container/).
85+
86+
Refer to the [Containers use cases page](/serverless-containers/reference-content/use-cases/) for more information on the different apps you can deploy using Serverless Containers.
87+
7588
## Hosting a website using Elastic Metal (Aluminium)
7689

7790
Elastic Metal (Aluminium) is an expert-level solution for users who require full control over the infrastructure. It provides optimal performance by leveraging the dedicated hardware resources at a cost lower than equivalent instances. You can install any operating system and applications you need, but you are responsible for maintaining your entire software stack.

pages/use-cases/application-hosting/index.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,22 @@ Looking to deploy a web application? Scaleway offers scalable and secure hosting
2222
url="/tutorials/deploy-saas-application/"
2323
/>
2424
</Grid>
25+
<Grid>
26+
<SummaryCard
27+
title="Hosting a Next.js web app with Serverless Containers"
28+
icon="book-open-outline"
29+
description="Quickly deploy a basic Next.js app with Serverless Containers."
30+
label="Read more"
31+
url="/tutorials/hosting-nextjs-webapp-serverless-containers/"
32+
/>
33+
<SummaryCard
34+
title="Deploying and host a Django web app with Serverless Containers"
35+
icon="book-open-outline"
36+
description="Easily deploy and scale containerized Django apps."
37+
label="Read more"
38+
url="/tutorials/hosting-django-webapp-serverless-containers/"
39+
/>
40+
</Grid>
2541

2642
## Related tutorials
2743

pages/use-cases/deploy-external-software/index.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ description: Discover how to deploy and manage external software with Scaleway's
77
Need to deploy and manage external software on your cloud infrastructure? Scaleway provides the tools and services to help you deploy, manage, and scale external software efficiently.
88

99
<Grid>
10+
<SummaryCard
11+
title="Deploying Open WebUI with Scaleway's Generative APIs"
12+
icon="info"
13+
description="Deploy a powerful web-based AI user interface with Serverless Containers."
14+
label="Read more"
15+
url="/tutorials/deploy-openwebui-with-generative-apis/"
16+
/>
1017
<SummaryCard
1118
title="Deploying Chatwoot on Scaleway General Purpose Instances"
1219
icon="rocket"
1320
description="With Chatwoot, businesses can set up multiple communication channels, integrate them into their websites or applications, and engage with customers in real-time."
1421
label="Read more"
1522
url="/tutorials/deploy-chatwoot-self-care/"
1623
/>
17-
<SummaryCard
18-
title="Creating a Valheim server with Scaleway"
19-
icon="info"
20-
description="Learn how to create your own Valheim gaming server with Scaleway Instances."
21-
label="Read more"
22-
url="/tutorials/create-valheim-server/"
23-
/>
2424
</Grid>
2525

2626
## Related tutorials

pages/use-cases/website-hosting/index.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ Need to deploy a simple or complex website? Scaleway provides the tools and infr
3838
label="Read more"
3939
url="/tutorials/wordpress-instantapp/"
4040
/>
41+
<SummaryCard
42+
title="Deploy and host a website with Serverless Containers"
43+
icon="book-open-outline"
44+
description="Easily deploy and scale containerized static websites."
45+
label="Read more"
46+
url="/tutorials/hosting-static-websites-serverless-containers/"
47+
/>
4148
</Grid>
4249

4350
## Related tutorials
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
---
2+
title: Hosting a Django web app with Serverless Containers
3+
description: This page provides guidelines on how to host and deploy dynamic Django web applications using Scaleway Serverless Containers
4+
tags: deploy host website webapp python django containerize application docker dockerfile
5+
products:
6+
- containers
7+
- container-registry
8+
dates:
9+
validation: 2025-10-06
10+
posted: 2025-10-06
11+
validation_frequency: 12
12+
difficulty: beginner
13+
usecase:
14+
- application-hosting
15+
- deploy-external-software
16+
- website-hosting
17+
ecosystem:
18+
- third-party
19+
---
20+
21+
import Requirements from '@macros/iam/requirements.mdx'
22+
23+
[Django](https://www.djangoproject.com/) is a robust Python framework designed for rapid development of secure and maintainable web applications. Hosting Django on [Scaleway Serverless Containers](/serverless-containers/) provides automatic scaling, simplified deployment, and reduced infrastructure management. This deployment method allows your application to efficiently handle varying workloads, while you can optimize resource usage, and focus on writing code and delivering features rather than maintaining servers.
24+
25+
<Requirements />
26+
27+
- A Scaleway account logged into the [console](https://console.scaleway.com)
28+
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
29+
- Installed [Docker](https://docs.docker.com/get-started/get-docker/) or [Docker Engine](https://docs.docker.com/engine/install/)
30+
- [Created a Scaleway Container Registry namespace](/container-registry/how-to/create-namespace/) and [logged into it](/container-registry/how-to/connect-docker-cli/)
31+
32+
## Create and host a basic Django web application
33+
34+
To host a [Django](https://www.djangoproject.com/) web application on **Scaleway Serverless Containers**, you need to create a Django project, define your views and URLs, and containerize it using a production-ready `Dockerfile`. The container will run a WSGI server (like Gunicorn) to serve your app. After building the image locally, push it to the [Scaleway Container Registry](/container-registry/) and deploy it via [Scaleway Serverless Containers](/serverless-containers/).
35+
36+
### Create your app and test it locally
37+
38+
1. In a terminal, create a new directory and navigate into it:
39+
```bash
40+
mkdir my-django-app
41+
cd my-django-app
42+
```
43+
44+
2. Create a virtual environment and install Django:
45+
46+
<Tabs id="python-venv">
47+
<TabsTab label="Linux/macOS">
48+
```bash
49+
python3 -m venv venv
50+
source venv/bin/activate
51+
pip install django gunicorn
52+
```
53+
</TabsTab>
54+
<TabsTab label="Windows">
55+
```bash
56+
python -m venv venv
57+
venv\Scripts\activate
58+
pip install django gunicorn
59+
```
60+
</TabsTab>
61+
</Tabs>
62+
63+
3. Start a new Django project:
64+
```bash
65+
django-admin startproject myproject .
66+
```
67+
68+
4. Verify the project structure:
69+
```
70+
my-django-app/
71+
├── myproject/
72+
│ ├── __init__.py
73+
│ ├── settings.py # Configuration
74+
│ ├── urls.py # URL routing
75+
│ └── wsgi.py # WSGI application entry point
76+
├── manage.py # CLI for Django commands
77+
└── venv/ # Virtual environment (excluded from Docker)
78+
```
79+
80+
5. Create a `requirements.txt` file and add the following code to it:
81+
```txt
82+
Django==5.1.*
83+
gunicorn==21.2.*
84+
```
85+
86+
6. Run the following command to test the app locally:
87+
```bash
88+
python manage.py runserver
89+
```
90+
Visit [http://localhost:8000](http://localhost:8000) to see the default Django welcome page.
91+
92+
### Build the app image and push it to Scaleway Container Registry
93+
94+
Before building and pushing your image, ensure you have [created a Scaleway Container Registry namespace](/container-registry/how-to/create-namespace/), and [logged into it with the Docker CLI](/container-registry/how-to/connect-docker-cli/).
95+
96+
1. Create a `Dockerfile` at the root of your Django app:
97+
```dockerfile
98+
# Use a lightweight Python image
99+
FROM python:3.11-slim
100+
101+
# Set working directory
102+
WORKDIR /app
103+
104+
# Install system dependencies
105+
RUN apt-get update && apt-get install -y --no-install-recommends \
106+
&& rm -rf /var/lib/apt/lists/*
107+
108+
# Copy and install Python dependencies
109+
COPY requirements.txt .
110+
RUN pip install --no-cache-dir -r requirements.txt
111+
112+
# Copy the rest of the application
113+
COPY . .
114+
115+
# Expose port
116+
EXPOSE 8000
117+
118+
# Run Gunicorn as the entrypoint
119+
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "myproject.wsgi:application"]
120+
```
121+
122+
2. Edit the `settings.py` file of your project with the code below to allow the Scaleway endpoint corresponding to your region, and remove unwanted endpoints:
123+
124+
```py
125+
ALLOWED_HOSTS = [
126+
'.fr-par.scw.cloud',
127+
'.nl-ams.scw.cloud',
128+
'.pl-waw.scw.cloud'
129+
]
130+
```
131+
132+
3. Build, tag, and push the image to Scaleway Container Registry:
133+
```bash
134+
docker build \
135+
--platform linux/amd64 \
136+
--push \
137+
-t <CONTAINER_REGISTRY_ENDPOINT>/my-django-app:latest .
138+
```
139+
<Message type="note">
140+
You can find your Container Registry endpoint in the **Overview** tab of your Container Registry namespace in the [Scaleway console](https://console.scaleway.com/registry/namespaces).
141+
</Message>
142+
143+
### Deploy your app using Serverless Containers
144+
145+
1. [Deploy a Serverless Container](/serverless-containers/how-to/deploy-container/) with the following settings:
146+
- **Registry**: Scaleway Container Registry
147+
- **Registry namespace**: The namespace where you pushed your image
148+
- **Container port**: `8000` as it is the [port](/serverless-containers/reference-content/port-parameter-variable/) exposed in the dockerfile.
149+
- **Resources**: `500 mVCPU` and `512 MB` memory
150+
- **Autoscaling**: Set minimum scale to `1` to avoid [cold starts](/serverless-containers/concepts/#cold-start) (optional)
151+
152+
Deployment may take up to a minute.
153+
154+
2. Once the container is **ready**, click the **container endpoint** in the **Overview** tab. Your Django app will be live and accessible to anyone with the link.
155+
156+
## Going further
157+
158+
- You can deploy an existing Django project by building and pushing its container image as shown above.
159+
- [Add a custom domain](/serverless-containers/how-to/add-a-custom-domain-to-a-container/) to your deployed app.

0 commit comments

Comments
 (0)