[英]Django served on specific URL - relative urls corrupted
I've deployed my Django (DRF API) project on DigitalOcean apps.我已经在 DigitalOcean 应用程序上部署了我的 Django (DRF API) 项目。 The path "/" is used by my static site that uses this API so I set route for this component to "/api" which works correctly.
我的 static 站点使用了路径“/”,该站点使用了这个 API,所以我将此组件的路由设置为正常工作的“/api”。
The problem:问题:
I go to /api/admin/
and it redirects me to /admin/login
but the django
is served on /api
url so this URL is invalid. I go to
/api/admin/
and it redirects me to /admin/login
but the django
is served on /api
url so this URL is invalid.
Do you know how to make this work?你知道如何进行这项工作吗?
Is there a way to tell django
to use absolute URL everywhere?有没有办法告诉
django
在任何地方使用绝对 URL ?
urls.py网址.py
urlpatterns = [
...
path("api/admin/", admin.site.urls),
...
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.