I recently deployed a dockerized Django app on DigitalOcean app platform alongside a react static site using the app spec file. Because of the static site, I opted to serve Django on a non-root URL (something like https: //mydomain .com/api) and serve the react app on the root URL (https: //mydomain .com).
If I visit the Django URL, Django comes up but throws a "path not found error". None of the routes on my Django app works. The solution doesn't seem to be on google either and I don't know why.
here is what my app.yaml looks like
name: test region: nyc services: - name: backend-api github: 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 routes: - path: /api static_sites: - name: frontend environment_slug: node-js github: branch: deployment_app_platform repo: NdibeRaymond/test deploy_on_push: true source_dir: frontend/test/ build_command: npm run build routes: - path: / gunicorn configuration
exec /usr/local/bin/gunicorn test.wsgi --threads=3 --bind 0.0.0.0:8000 --chdir /backend/test root URL file
urlpatterns = [ path('admin/', admin.site.urls), 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/admin/', admin.site.urls), 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) https://stackoverflow.com/questions/67249095/digitalocean-app-platform-host-dockerized-django-app-with-gunicorn-on-a-non-roo April 25, 2021 at 10:04AM
没有评论:
发表评论