This example shows how to run a standard Django 5 project on Wasmer Edge.
https://django-template.wasmer.app/
Key files to know:
api/settings.py- Adds the sample app (
'example') toINSTALLED_APPS. - Sets
ALLOWED_HOSTS = ['127.0.0.1', '.wasmer.app']so both local development and Wasmer Edge subdomains work. - Points
WSGI_APPLICATIONtoapi.wsgi.app, meaning Wasmer will importapi/wsgi.pyand look forapp.
- Adds the sample app (
api/wsgi.py- Calls
get_wsgi_application()and exposes it as a module-level variable namedapp(the entrypoint Wasmer runs).
- Calls
example/views.py- Defines
index(request)which renders the current time in a simple HTML page.
- Defines
example/urls.pyandapi/urls.py- Wire the
indexview to the root URL (/) and include it in the project’s root URL patterns.
- Wire the
Because Django serves via WSGI, Wasmer Edge runs the project without extra adapters.
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt # or pip install django
python manage.py migrate
python manage.py runserverVisit http://127.0.0.1:8000/ to see the “Hello from Wasmer!” page with the current timestamp.
- Collect static files and apply migrations as part of your build (e.g.,
python manage.py collectstatic --no-input). - Ensure
api.wsgi:appis the entrypoint in your deployment configuration. - Deploy to Wasmer Edge and browse to
https://<your-subdomain>.wasmer.app/.