App-Platform: Serve dockerized django (gunicorn server) on non-root url

Posted April 24, 2021 32 views
DjangoDigitalOcean App Platform

I recently deployed a dockerized Django app on DigitalOcean app platform along-side a react static site using the app spec file. Because of the static site, I opted to server django on a non-root URL (something like and serve the react app on the root-url (

If I visit the django URL, django comes up but throws a “path not found error”. The solution doesn’t see to be on google either and I don’t know why.

here is what my app.yaml looks like

name: test
region: nyc
  - name: backend-api
      branch: deployment_app_platform
      repo: NdibeRaymond/test
      deploy_on_push: true

    http_port: 8000
    instance_count: 1
    instance_size_slug: basic-xxs
    source_dir: backend/
    dockerfile_path: backend/compose/django/Dockerfile
      - path: /api

  - name: frontend
    environment_slug: node-js
      branch: deployment_app_platform
      repo: NdibeRaymond/test
      deploy_on_push: true

    source_dir: frontend/test/
    build_command: npm run build
      - path: /

gunicorn configuration

exec /usr/local/bin/gunicorn test.wsgi --threads=3 --bind --chdir /backend/test

root URL file

urlpatterns = [
    path('api-auth/', include('rest_framework.urls')),
    path('summernote/', include('django_summernote.urls')),
    path('', include('APIS.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

I also tried

urlpatterns = [
    path('api/api-auth/', include('rest_framework.urls')),
    path('api/summernote/', include('django_summernote.urls')),
    path('api/', include('APIS.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!