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
Copy file name to clipboardExpand all lines: tutorials/hosting-django-webapp-serverless-containers/index.mdx
+14-4Lines changed: 14 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,13 +75,13 @@ To host a [Django](https://www.djangoproject.com/) web application on **Scaleway
75
75
└── venv/ # Virtual environment (excluded from Docker)
76
76
```
77
77
78
-
5. Create a `requirements.txt` file:
78
+
5. Create a `requirements.txt` file and add the following code to it:
79
79
```txt
80
80
Django==5.1.*
81
81
gunicorn==21.2.*
82
82
```
83
83
84
-
6.Test the app locally:
84
+
6.Run the following command to test the app locally:
85
85
```bash
86
86
python manage.py runserver
87
87
```
@@ -91,7 +91,7 @@ To host a [Django](https://www.djangoproject.com/) web application on **Scaleway
91
91
92
92
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/)
93
93
94
-
1. Create a `Dockerfile` at the root of your project:
94
+
1. Create a `Dockerfile` at the root of your Django app:
95
95
```dockerfile
96
96
# Use a lightweight Python image
97
97
FROM python:3.11-slim
@@ -117,7 +117,17 @@ Before building and pushing your image, ensure you have [created a Scaleway Cont
2. Build, tag, and push the image to Scaleway Container Registry:
120
+
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:
121
+
122
+
```py
123
+
ALLOWED_HOSTS= [
124
+
'.fr-par.scw.cloud',
125
+
'.nl-ams.scw.cloud',
126
+
'.pl-waw.scw.cloud'
127
+
]
128
+
```
129
+
130
+
3. Build, tag, and push the image to Scaleway Container Registry:
- A Scaleway account logged into the [console](https://console.scaleway.com)
23
26
-[Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
24
27
- Installed [Docker](https://docs.docker.com/get-started/get-docker/) or [Docker Engine](https://docs.docker.com/engine/install/)
25
28
-[Created a Scaleway Container Registry namespace](/container-registry/how-to/create-namespace/) and [logged into it](/container-registry/how-to/connect-docker-cli/)
0 commit comments