1、在setting中设置
BASE_DIR = Path(file).resolve().parent.parent
MAP_ROOT = os.path.join(BASE_DIR,‘newtask’)
AMAP_ROOT = os.path.join(BASE_DIR,‘arcgisblack’)
2、在项目的url中设置路径
urlpatterns += static(‘/newtask/’,document_root=settings.MAP_ROOT)
urlpatterns += static(‘/arcgisblack/’,document_root=settings.AMAP_ROOT)
3、在url中引用
var baseLayers = {
“街景地图”: L.tileLayer(“/newtask/{z}/{x}/{y}.png”,{“attribution”: “default”, “detectRetina”: false, “maxNativeZoom”: 18, “maxZoom”: 18, “minZoom”: 0, “noWrap”: false, “opacity”: 1, “subdomains”: “abc”, “tms”: false}
).addTo(map),
};