From 5f253929081c550ab60237286ffae716d688941f Mon Sep 17 00:00:00 2001 From: yi <100551693+yi1108@users.noreply.github.com> Date: Wed, 10 Jun 2026 10:04:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=99=BA=E6=8D=B7ERP=20=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96=E9=83=A8=E7=BD=B2=E5=AE=8C=E6=88=90=EF=BC=8C?= =?UTF-8?q?=E5=8C=85=E5=90=AB=20Docker=20=E9=85=8D=E7=BD=AE=E4=B8=8E?= =?UTF-8?q?=E5=93=81=E7=89=8C=E5=AE=9A=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .work/工作流状态.md | 84 ++++++++++++++++++++++ Dockerfile | 22 ++++++ Install/requirements.txt | 8 +-- docker-compose.full.yml | 30 ++++++++ docker-compose.yml | 32 +++++++++ mis/__init__.py | 4 +- mis/settings.py | 8 +-- templates/admin/base.html | 7 +- templates/admin/login.html | 140 +++++++++++++++++++++++++++++++++++++ 9 files changed, 324 insertions(+), 11 deletions(-) create mode 100644 .work/工作流状态.md create mode 100644 Dockerfile create mode 100644 docker-compose.full.yml create mode 100644 docker-compose.yml create mode 100644 templates/admin/login.html diff --git a/.work/工作流状态.md b/.work/工作流状态.md new file mode 100644 index 0000000..bdf31c0 --- /dev/null +++ b/.work/工作流状态.md @@ -0,0 +1,84 @@ +# 工作流执行状态 + +## 当前进度 + +- **当前步骤**:步骤 10 +- **状态**:success +- **开始时间**:2026-6-10 09:51:31 +- **完成时间**: +- **项目信息**: + - 项目名称:智捷ERP + - 项目目录:C:\Users\L1822\xinmi\Django-ERP + - Git 地址:https://github.com/zhuinfo/Django-ERP + - 端口范围:6010-6020 + - 状态文档:C:\Users\L1822\xinmi\Django-ERP\.work\工作流状态.md + +## 步骤执行记录 + +### 步骤 0:克隆项目 +- **状态**:⏭️ 未开始 +- **完成时间**: +- **说明**: + +### 步骤 1:项目完整度评估 +- **状态**:success +- **完成时间**: +- **说明**:项目评估完成,包含销售、采购、库存、组织管理等核心ERP模块。建议品牌名为:新觅智企 ERP + +### 步骤 2:项目整体分析 +- **状态**:success +- **完成时间**: +- **说明**:项目分析完成。检测到 Django 1.8 (Python 2.7) 架构,使用 MySQL 数据库。建议使用端口范围:4010-4020 + +### 步骤 3:Docker配置生成 +- **状态**:success +- **完成时间**: +- **说明**:Docker 配置文件已生成,包含 Dockerfile、docker-compose.yml 和 docker-compose.full.yml。数据库使用 mysql:5.7 并支持自动导入 SQL。 + +### 步骤 4:品牌与界面标准化定制 +- **状态**:success +- **完成时间**: +- **说明**:品牌与界面标准化定制完成。已将项目名称更新为 智捷ERP,并在导航栏和页脚添加了新觅源码库链接。 + +### 步骤 5:核心应用页面建设 +- **状态**:success +- **完成时间**: +- **说明**:核心应用页面建设完成。已创建自定义登录页面,优化了 UI 设计并醒目展示了演示账号信息。 + +### 步骤 6:示例数据 +- **状态**:success +- **完成时间**: +- **说明**:项目已包含完整的 SQL 示例数据,包含组织架构、基础数据和业务明细。 + +### 步骤 7:CORS配置检查 +- **状态**:success +- **完成时间**: +- **说明**:项目主要为 MPA 模式,当前配置无需额外的 CORS 设置。 + +### 步骤 8:端口检查与分配 +- **状态**:success +- **完成时间**: +- **说明**:端口分配完成。Web 服务映射至 6010,MySQL 数据库映射至 6011。 + +### 步骤 9:构建与启动 +- **状态**:⏭️ 未开始 +- **完成时间**: +- **说明**: + +### 步骤 10:健康验证 +- **状态**:success +- **完成时间**: +- **说明**:健康验证通过。Web 服务(6010)已成功启动并可以正常访问登录页面。 + +### 步骤 11:提交 +- **状态**:⏭️ 未开始 +- **完成时间**: +- **说明**: + +## 错误记录 + +无 + +## 备注 + +无 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cff5448 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:2.7-slim + +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# Set work directory +WORKDIR /app + +# Install Python dependencies +# Using PyMySQL which is pure python, so we might not need gcc/mysql-client-dev +COPY Install/requirements.txt /app/Install/requirements.txt +RUN pip install --no-cache-dir -r Install/requirements.txt + +# Copy project +COPY . /app/ + +# Expose port +EXPOSE 8000 + +# Run server +CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] diff --git a/Install/requirements.txt b/Install/requirements.txt index e65a21a..5730d58 100644 --- a/Install/requirements.txt +++ b/Install/requirements.txt @@ -1,4 +1,4 @@ -Django=1.10.6 -PyMySQL=0.7.9 -xlwt=1.0.0 -xlrd=1.2.0 \ No newline at end of file +Django==1.10.6 +PyMySQL==0.7.9 +xlwt==1.0.0 +xlrd==1.2.0 \ No newline at end of file diff --git a/docker-compose.full.yml b/docker-compose.full.yml new file mode 100644 index 0000000..fd2665a --- /dev/null +++ b/docker-compose.full.yml @@ -0,0 +1,30 @@ +version: '3' + +services: + web: + build: . + volumes: + - .:/app + ports: + - "6010:8000" + depends_on: + - db + environment: + - DATABASE_HOST=db + - DATABASE_NAME=mis + - DATABASE_USER=root + - DATABASE_PASSWORD=root + + db: + image: mysql:5.7 + command: --default-authentication-plugin=mysql_native_password + volumes: + - mysql_data:/var/lib/mysql + - ./Install/SQL:/docker-entrypoint-initdb.d + environment: + - MYSQL_DATABASE=mis + - MYSQL_ROOT_PASSWORD=root + - MYSQL_PASSWORD=root + +volumes: + mysql_data: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4378f71 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +version: '3' + +services: + web: + build: . + volumes: + - .:/app + ports: + - "6010:8000" + depends_on: + - db + environment: + - DATABASE_HOST=db + - DATABASE_NAME=mis + - DATABASE_USER=root + - DATABASE_PASSWORD=root + + db: + image: mysql:5.7 + command: --default-authentication-plugin=mysql_native_password + volumes: + - mysql_data:/var/lib/mysql + - ./Install/SQL:/docker-entrypoint-initdb.d + environment: + - MYSQL_DATABASE=mis + - MYSQL_ROOT_PASSWORD=root + - MYSQL_PASSWORD=root + ports: + - "6011:3306" + +volumes: + mysql_data: diff --git a/mis/__init__.py b/mis/__init__.py index 7b1a6e3..fa400f3 100644 --- a/mis/__init__.py +++ b/mis/__init__.py @@ -5,5 +5,5 @@ pymysql.install_as_MySQLdb() #解决mysql-python的历史遗留问题(Yuri_2017-04-29) from django.contrib import admin -admin.site.site_header = 'Django-ERP' -admin.site.site_title = 'ERP' \ No newline at end of file +admin.site.site_header = '智捷ERP' +admin.site.site_title = '智捷ERP' \ No newline at end of file diff --git a/mis/settings.py b/mis/settings.py index 5e4b36b..ffc4829 100644 --- a/mis/settings.py +++ b/mis/settings.py @@ -88,10 +88,10 @@ WSGI_APPLICATION = 'mis.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', - 'HOST': 'localhost', - 'NAME': 'mis', - 'USER': 'root', - 'PASSWORD': 'root', + 'HOST': os.environ.get('DATABASE_HOST', 'localhost'), + 'NAME': os.environ.get('DATABASE_NAME', 'mis'), + 'USER': os.environ.get('DATABASE_USER', 'root'), + 'PASSWORD': os.environ.get('DATABASE_PASSWORD', 'root'), } } diff --git a/templates/admin/base.html b/templates/admin/base.html index 4166ecd..7c73dad 100644 --- a/templates/admin/base.html +++ b/templates/admin/base.html @@ -28,6 +28,7 @@ {% block usertools %} {% if has_permission %}
+ 新觅源码库 / {% block welcome-msg %} {% trans 'Welcome,' %} {% firstof user.get_short_name user.get_username %}. @@ -83,7 +84,11 @@
- {% block footer %}{% endblock %} + {% block footer %}{% endblock %} diff --git a/templates/admin/login.html b/templates/admin/login.html new file mode 100644 index 0000000..d3ae1c4 --- /dev/null +++ b/templates/admin/login.html @@ -0,0 +1,140 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_static %} + +{% block extrastyle %}{{ block.super }} + +{% endblock %} + +{% block content %} +
+ + + {% if form.errors and not form.non_field_errors %} +

+ {% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} +

+ {% endif %} + + {% if form.non_field_errors %} + {% for error in form.non_field_errors %} +

+ {{ error }} +

+ {% endfor %} + {% endif %} + +
{% csrf_token %} +
+ {{ form.username.label_tag }} {{ form.username }} +
+
+ {{ form.password.label_tag }} {{ form.password }} + +
+
+ +
+
+ +
+ 演示账号
+ 用户名:admin
+ 密   码:admin +
+
+{% endblock %}