fix: 静态资源路径改用 Django {% static %} 模板变量,确保离线部署兼容
This commit is contained in:
@@ -514,6 +514,9 @@
|
||||
<script src="{% static 'simple_analysis/maps/topojson-client.min.js' %}"></script>
|
||||
|
||||
<script>
|
||||
/* ── Static URL paths for offline assets ─────────────── */
|
||||
const STATIC_MAPS = '{% static "simple_analysis/maps" %}';
|
||||
const STATIC_WORLD_MAP = '{% static "simple_analysis/world_map.svg" %}';
|
||||
/* ── State ────────────────────────────────────────────── */
|
||||
const SA = {
|
||||
sessionId: null,
|
||||
@@ -1171,7 +1174,7 @@ function renderClusterCards(clusters) {
|
||||
/* ── Step 4: Map (static SVG world map + large clickable points) ── */
|
||||
|
||||
// World map image path
|
||||
const WORLD_MAP_URL = '/static/simple_analysis/world_map.svg';
|
||||
const WORLD_MAP_URL = STATIC_WORLD_MAP;
|
||||
|
||||
// Subnet color palette (high-contrast against map background)
|
||||
const SUBNET_COLORS = [
|
||||
@@ -1193,9 +1196,9 @@ function getSubnetColor(ip) {
|
||||
/* ── Load offline TopoJSON world map (fallback to CartoDB tiles) ── */
|
||||
function loadOfflineWorldMap(map) {
|
||||
const mapFiles = [
|
||||
{ url: '/static/simple_analysis/maps/land-10m.json', obj: 'ne_10m_land', label: '10m精细' },
|
||||
{ url: '/static/simple_analysis/maps/land-50m.json', obj: 'land', label: '50m标准' },
|
||||
{ url: '/static/simple_analysis/maps/land-110m.json', obj: 'land', label: '110m基础' },
|
||||
{ url: STATIC_MAPS + '/land-10m.json', obj: 'ne_10m_land', label: '10m精细' },
|
||||
{ url: STATIC_MAPS + '/land-50m.json', obj: 'land', label: '50m标准' },
|
||||
{ url: STATIC_MAPS + '/land-110m.json', obj: 'land', label: '110m基础' },
|
||||
];
|
||||
|
||||
function tryLoad(idx) {
|
||||
|
||||
Reference in New Issue
Block a user