简体   繁体   中英

Django served on specific URL - relative urls corrupted

I've deployed my Django (DRF API) project on DigitalOcean apps. The path "/" is used by my static site that uses this API so I set route for this component to "/api" which works correctly.

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.

Do you know how to make this work?

Is there a way to tell django to use absolute URL everywhere?

urls.py

urlpatterns = [
    ...
    path("api/admin/", admin.site.urls),
    ...
]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM