修复
This commit is contained in:
@@ -30,7 +30,7 @@ export const checkEnvironmentVariables = () => {
|
|||||||
|
|
||||||
// 检查可选的环境变量
|
// 检查可选的环境变量
|
||||||
const devServerHost = import.meta.env.VITE_DEV_SERVER_HOST || 'localhost'
|
const devServerHost = import.meta.env.VITE_DEV_SERVER_HOST || 'localhost'
|
||||||
const devServerPort = import.meta.env.VITE_DEV_SERVER_PORT || '3000'
|
const devServerPort = import.meta.env.VITE_DEV_SERVER_PORT || '3001'
|
||||||
|
|
||||||
const optionalVars = [
|
const optionalVars = [
|
||||||
{ key: 'VITE_DEV_SERVER_HOST', value: devServerHost },
|
{ key: 'VITE_DEV_SERVER_HOST', value: devServerHost },
|
||||||
@@ -72,7 +72,7 @@ export const validateEnvironment = () => {
|
|||||||
|
|
||||||
// 获取API基础地址
|
// 获取API基础地址
|
||||||
export const getApiBaseUrl = (): string => {
|
export const getApiBaseUrl = (): string => {
|
||||||
return import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000/api'
|
return import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001/api'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取应用配置
|
// 获取应用配置
|
||||||
@@ -82,6 +82,6 @@ export const getAppConfig = () => {
|
|||||||
version: import.meta.env.VITE_APP_VERSION || '1.0.0',
|
version: import.meta.env.VITE_APP_VERSION || '1.0.0',
|
||||||
apiBaseUrl: getApiBaseUrl(),
|
apiBaseUrl: getApiBaseUrl(),
|
||||||
devServerHost: import.meta.env.VITE_DEV_SERVER_HOST || 'localhost',
|
devServerHost: import.meta.env.VITE_DEV_SERVER_HOST || 'localhost',
|
||||||
devServerPort: import.meta.env.VITE_DEV_SERVER_PORT || '3000',
|
devServerPort: import.meta.env.VITE_DEV_SERVER_PORT || '3001',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,16 +122,16 @@ export const showRoutesInfo = () => {
|
|||||||
console.log(' 💡 提示: 可以在浏览器中直接访问这些路径')
|
console.log(' 💡 提示: 可以在浏览器中直接访问这些路径')
|
||||||
|
|
||||||
console.log('\n🌐 可用链接:')
|
console.log('\n🌐 可用链接:')
|
||||||
console.log(' http://localhost:3000/ - 首页 (需要登录)')
|
console.log(' http://localhost:3001/ - 首页 (需要登录)')
|
||||||
console.log(' http://localhost:3000/login - 登录页面')
|
console.log(' http://localhost:3001/login - 登录页面')
|
||||||
console.log(' http://localhost:3000/dashboard - 仪表板 (需要登录)')
|
console.log(' http://localhost:3001/dashboard - 仪表板 (需要登录)')
|
||||||
console.log(' http://localhost:3000/user - 用户管理 (需要登录)')
|
console.log(' http://localhost:3001/user - 用户管理 (需要登录)')
|
||||||
console.log(' http://localhost:3000/profile - 个人资料 (需要登录)')
|
console.log(' http://localhost:3001/profile - 个人资料 (需要登录)')
|
||||||
console.log(' http://localhost:3000/settings - 系统设置 (需要登录)')
|
console.log(' http://localhost:3001/settings - 系统设置 (需要登录)')
|
||||||
console.log(' http://localhost:3000/test - 样式测试 (公开)')
|
console.log(' http://localhost:3001/test - 样式测试 (公开)')
|
||||||
console.log(' http://localhost:3000/websocket-test - WebSocket测试 (公开)')
|
console.log(' http://localhost:3001/websocket-test - WebSocket测试 (公开)')
|
||||||
console.log(' http://localhost:3000/demo - 动态路由演示 (公开)')
|
console.log(' http://localhost:3001/demo - 动态路由演示 (公开)')
|
||||||
console.log(' http://localhost:3000/any-other-path - 404页面 (公开)')
|
console.log(' http://localhost:3001/any-other-path - 404页面 (公开)')
|
||||||
|
|
||||||
console.log('\n✅ 路由配置加载完成!')
|
console.log('\n✅ 路由配置加载完成!')
|
||||||
console.log('💡 提示: 启动项目后会在控制台看到真正的动态路由信息')
|
console.log('💡 提示: 启动项目后会在控制台看到真正的动态路由信息')
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export function getFullFileUrl(relativePath: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 在生产环境中,拼接完整的URL
|
// 在生产环境中,拼接完整的URL
|
||||||
const baseURL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000'
|
const baseURL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001'
|
||||||
return `${baseURL}${relativePath}`
|
return `${baseURL}${relativePath}`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ export function getApiBaseUrl(): string {
|
|||||||
if (import.meta.env.DEV) {
|
if (import.meta.env.DEV) {
|
||||||
return '' // 开发环境使用空字符串,通过Vite代理
|
return '' // 开发环境使用空字符串,通过Vite代理
|
||||||
}
|
}
|
||||||
return import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000'
|
return import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,7 +47,7 @@ export function getMediaBaseUrl(): string {
|
|||||||
if (import.meta.env.DEV) {
|
if (import.meta.env.DEV) {
|
||||||
return '' // 开发环境使用空字符串,通过Vite代理
|
return '' // 开发环境使用空字符串,通过Vite代理
|
||||||
}
|
}
|
||||||
const baseURL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000'
|
const baseURL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001'
|
||||||
return baseURL.replace('/api', '') // 移除/api后缀
|
return baseURL.replace('/api', '') // 移除/api后缀
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -468,7 +468,7 @@ const formatDate = (dateString: string) => {
|
|||||||
const getImageUrl = (filePath: string) => {
|
const getImageUrl = (filePath: string) => {
|
||||||
if (!filePath) return ''
|
if (!filePath) return ''
|
||||||
if (filePath.startsWith('http')) return filePath
|
if (filePath.startsWith('http')) return filePath
|
||||||
return `http://localhost:3000${filePath}`
|
return `http://localhost:3001${filePath}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理图片加载错误
|
// 处理图片加载错误
|
||||||
|
|||||||
@@ -477,7 +477,7 @@ const inferenceMode = ref<'pt' | 'onnx'>('pt')
|
|||||||
|
|
||||||
// WebSocket连接(PT推理模式使用)
|
// WebSocket连接(PT推理模式使用)
|
||||||
let ws: WebSocket | null = null
|
let ws: WebSocket | null = null
|
||||||
const wsUrl = 'ws://localhost:3000/ws/yolo/live/'
|
const wsUrl = 'ws://localhost:8000/ws/yolo/live/'
|
||||||
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
@@ -1342,7 +1342,7 @@ const handleOnnxUpload = async () => {
|
|||||||
|
|
||||||
// 如果URL不是完整路径,构建完整URL
|
// 如果URL不是完整路径,构建完整URL
|
||||||
if (!labelsDownloadUrl.startsWith('http')) {
|
if (!labelsDownloadUrl.startsWith('http')) {
|
||||||
const baseUrl = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000'
|
const baseUrl = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001'
|
||||||
labelsDownloadUrl = labelsDownloadUrl.startsWith('/')
|
labelsDownloadUrl = labelsDownloadUrl.startsWith('/')
|
||||||
? `${baseUrl}${labelsDownloadUrl}`
|
? `${baseUrl}${labelsDownloadUrl}`
|
||||||
: `${baseUrl}/${labelsDownloadUrl}`
|
: `${baseUrl}/${labelsDownloadUrl}`
|
||||||
@@ -1417,7 +1417,7 @@ const handleOnnxUpload = async () => {
|
|||||||
|
|
||||||
// 如果URL不是完整路径,构建完整URL
|
// 如果URL不是完整路径,构建完整URL
|
||||||
if (!downloadUrl.startsWith('http')) {
|
if (!downloadUrl.startsWith('http')) {
|
||||||
const baseUrl = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000'
|
const baseUrl = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001'
|
||||||
downloadUrl = downloadUrl.startsWith('/')
|
downloadUrl = downloadUrl.startsWith('/')
|
||||||
? `${baseUrl}${downloadUrl}`
|
? `${baseUrl}${downloadUrl}`
|
||||||
: `${baseUrl}/${downloadUrl}`
|
: `${baseUrl}/${downloadUrl}`
|
||||||
|
|||||||
@@ -1142,7 +1142,7 @@ const startDetection = async () => {
|
|||||||
|
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
// 构建完整的图片URL
|
// 构建完整的图片URL
|
||||||
const baseUrl = 'http://localhost:3000' // 后端服务器地址
|
const baseUrl = 'http://localhost:3001'
|
||||||
|
|
||||||
console.log('🔍 原始URL数据:', {
|
console.log('🔍 原始URL数据:', {
|
||||||
original_file_url: response.data.original_file_url,
|
original_file_url: response.data.original_file_url,
|
||||||
|
|||||||
@@ -19,13 +19,19 @@ from django.conf import settings
|
|||||||
from django.conf.urls.static import static
|
from django.conf.urls.static import static
|
||||||
from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView
|
from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView
|
||||||
from . import views
|
from . import views
|
||||||
|
from hertz_studio_django_captcha import urls as captcha_urls
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
_BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
sys.path.insert(0, str(_BASE_DIR))
|
||||||
|
from hertz_studio_django_codegen import urls as codegen_urls
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
# 首页路由
|
# 首页路由
|
||||||
path('', views.index, name='index'),
|
path('', views.index, name='index'),
|
||||||
|
|
||||||
# Hertz Captcha routes
|
# Hertz Captcha routes
|
||||||
path('api/captcha/', include('hertz_studio_django_captcha.urls')),
|
path('api/captcha/', include(captcha_urls)),
|
||||||
|
|
||||||
# Hertz Auth routes
|
# Hertz Auth routes
|
||||||
path('api/', include('hertz_studio_django_auth.urls')),
|
path('api/', include('hertz_studio_django_auth.urls')),
|
||||||
@@ -49,7 +55,7 @@ urlpatterns = [
|
|||||||
path('api/wiki/', include('hertz_studio_django_wiki.urls')),
|
path('api/wiki/', include('hertz_studio_django_wiki.urls')),
|
||||||
|
|
||||||
# Hertz Codegen routes
|
# Hertz Codegen routes
|
||||||
path('api/codegen/', include(('hertz_studio_django_codegen.urls', 'hertz_studio_django_codegen'), namespace='codegen')),
|
path('api/codegen/', include((codegen_urls, 'codegen'), namespace='codegen')),
|
||||||
|
|
||||||
# Hertz YOLO routes
|
# Hertz YOLO routes
|
||||||
path('api/yolo/', include('hertz_studio_django_yolo.urls')),
|
path('api/yolo/', include('hertz_studio_django_yolo.urls')),
|
||||||
|
|||||||
Reference in New Issue
Block a user