test
This commit is contained in:
@@ -15,5 +15,8 @@ RUN pip install --upgrade pip && pip install -r requirements.txt
|
|||||||
# Copy project
|
# Copy project
|
||||||
COPY . /app/
|
COPY . /app/
|
||||||
|
|
||||||
|
# Expose port
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|
||||||
|
|||||||
@@ -17,3 +17,4 @@ rpds-py==0.30.0
|
|||||||
sqlparse==0.5.5
|
sqlparse==0.5.5
|
||||||
uritemplate==4.2.0
|
uritemplate==4.2.0
|
||||||
wechatpayv3==2.0.1
|
wechatpayv3==2.0.1
|
||||||
|
drf-spectacular-sidecar==2026.1.1
|
||||||
|
|||||||
Binary file not shown.
@@ -160,8 +160,8 @@ class SalespersonAdmin(ModelAdmin):
|
|||||||
total_sales_display.short_description = "累计销售额 (已支付)"
|
total_sales_display.short_description = "累计销售额 (已支付)"
|
||||||
|
|
||||||
def promotion_url(self, obj):
|
def promotion_url(self, obj):
|
||||||
# 假设前端部署在 localhost:5173,生产环境需配置
|
# 假设前端部署在 localhost:15173,生产环境需配置
|
||||||
base_url = "http://localhost:5173"
|
base_url = "http://localhost:15173"
|
||||||
return f"{base_url}/?ref={obj.code}"
|
return f"{base_url}/?ref={obj.code}"
|
||||||
|
|
||||||
@display(description="推广链接")
|
@display(description="推广链接")
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ services:
|
|||||||
- ./frontend:/app
|
- ./frontend:/app
|
||||||
- /app/node_modules
|
- /app/node_modules
|
||||||
ports:
|
ports:
|
||||||
- "5173:5173"
|
- "15173:15173"
|
||||||
environment:
|
environment:
|
||||||
- VITE_API_URL=http://localhost:8000/api
|
- VITE_API_URL=http://localhost:8000/api
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Use an official Node runtime as a parent image
|
# Use an official Node runtime as a parent image
|
||||||
FROM node:18-alpine
|
FROM node:22-alpine
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -8,11 +8,17 @@ WORKDIR /app
|
|||||||
COPY package.json package-lock.json* ./
|
COPY package.json package-lock.json* ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
# Copy project files
|
# 复制项目文件
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Expose the port the app runs on
|
# 设置环境变量供构建时使用
|
||||||
EXPOSE 5173
|
ENV VITE_API_URL=http://localhost:8000/api
|
||||||
|
|
||||||
# Start the application
|
# 构建生产环境代码
|
||||||
CMD ["npm", "run", "dev", "--", "--host"]
|
RUN npm run build
|
||||||
|
|
||||||
|
# 暴露应用运行的端口
|
||||||
|
EXPOSE 15173
|
||||||
|
|
||||||
|
# 启动应用 (Preview 模式)
|
||||||
|
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "15173"]
|
||||||
|
|||||||
@@ -1,7 +1,16 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react'
|
||||||
|
|
||||||
|
//123
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
|
server: {
|
||||||
|
host: '0.0.0.0',
|
||||||
|
port: 5173,
|
||||||
|
},
|
||||||
|
preview: {
|
||||||
|
host: '0.0.0.0',
|
||||||
|
port: 15173,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user