Code Monkey home page Code Monkey logo

erp's Introduction

ERP管理系统-代码运行说明

  • 开源的ERP系统,使用django+vue搭建,目前demo搭建在erp.tanfuhua.com
  • 有产品管理、采购管理、生成管理、销售管理、财务管理、报表统计、系统管理板块,包含不同权限,覆盖绝大部分ERP的场景
  • erp.tanfuhua.com(用户名:管理员,密码:123456) 展示

开发环境要求

  • Python版本为V3.9+ (推荐使用conda控制版本)
  • Django版本为V3.2+
  • nodejs 为 12.13.1(推荐使用nvm 控制版本)
  • 数据库为MySQL 8.0+

本地运行流程

前端运行 nodejs 为 12.13.1

# 安装yarn
npm install yarn
# yarn安装依赖包
yarn install
# 在utils/config.js里设置自己的后端地址-baseUrl
# 前端 运行
yarn serve

修改ProjectName

# 在frontend\src\main.js里可以修改ProjectName和OnwerName为你自己的项目名称

后端运行

# 切换python环境
conda activate erp
# 安装依赖包
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
# 运行
python manage.py runserver

数据库设置

  1. 数据库字符集设置为 utf8mb4
  2. 创建 erp-db 数据库(先设置字符集, 再创建数据库) CREATE DATABASE erp_db;
  3. configs/django.py里修改password,user,host,port(你的ip)字段
  4. 迁移数据库
    • python manage.py makemigrations
    • python manage.py migrate
  5. 创建管理员用户(编号请输入为2)
    • python manage.py runscript create_user
  6. 初始化样例数据(可选)
    • python manage.py runscript create_test_data
  7. 初始化权限数据(可选)
    • python manage.py runscript init_permission

服务器部署流程(前端使用nginx,后端使用uwsgi)

后端部署

  1. 配置 uwsgi pip install uwsgi
  2. 运行 uwsgi uwsgi --ini [项目路径]/configs/uwsgi.ini

uwsgi配置文件

[uwsgi]
master = true
processes = 1
threads = 2
chdir = /www/wwwroot/erp.tanfuhua.com
wsgi-file= /www/wwwroot/erp.tanfuhua.com/project/wsgi.py
http = 0.0.0.0:8000
logto = /www/wwwroot/erp.tanfuhua.com/logs/error.log
chmod-socket = 660
vacuum = true
master = true
uid=root
gid=root
max-requests = 1000

前端部署

  1. 配置 nginx(配置文件在 /configs/nginx)
  2. 构建前端文件 进入 frontend 目录, yarn build
  3. 将dist文件上传至服务器(nginx里配置的目录)

nginx配置参数

server
{
    listen 80;
	listen 443 ssl http2;
    server_name 【域名地址】;
    root 【dist文件存放路径】;
    index  index.html index.htm;

    


    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    ssl_certificate    /www/server/panel/vhost/cert/erp.tanfuhua.com/fullchain.pem;
    ssl_certificate_key    /www/server/panel/vhost/cert/erp.tanfuhua.com/privkey.pem;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    add_header Strict-Transport-Security "max-age=31536000";
    error_page 497  https://$host$request_uri;


    #SSL-END

    #ERROR-PAGE-START  错误页配置,可以注释、删除或修改
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END

    #PHP-INFO-START  PHP引用配置,可以注释或修改
    include enable-php-73.conf;
    #PHP-INFO-END

    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /www/server/panel/vhost/rewrite/erp.tanfuhua.com.conf;
    #REWRITE-END

    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }

    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log /dev/null;
        access_log /dev/null;
    }
    
  	location /api/ {
  		proxy_pass http://localhost:【后端运行端口地址】/api/;
  		proxy_set_header Host $http_host;
  		proxy_set_header X-Forwarded-Proto $scheme;
  	}

    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log /dev/null;
        access_log /dev/null;
    }
    access_log  【日志文件存放地址】;
    error_log  【日志文件存放地址】;
}

数据库部署流程同本地部署流程一致(注意确保configs/django.py里的数据库配置正确)

界面截图

首页 首页 报表 库存 产品 产品 采购 采购 销售 销售 生产 生产 库存 库存 财务 财务 设置 设置 登录板块 登录板块 注册板块 注册板块 首页板块 首页板块 产品板块 产品板块 采购管理 采购管理 生产管理 生产管理 销售管理 销售管理 财务管理 财务管理 报表统计 报表统计 系统管理 系统管理

erp's People

Contributors

tfh-yqf avatar

Stargazers

 avatar  avatar XuHaolin avatar  avatar YUAN avatar Zzhou avatar  avatar  avatar wanglei avatar  avatar  avatar  avatar  avatar zhishui avatar  avatar  avatar DiDi avatar George avatar 空白 avatar Scott avatar ssopx avatar  avatar dsfiuuo avatar Sophie Martinelli avatar  avatar Red avatar  avatar ssqweq avatar chimera kang avatar deqinssa avatar  avatar  avatar qychui avatar HelloBagus avatar 窍门 avatar  avatar  avatar  avatar name007 avatar ruhai avatar  avatar 久绊A avatar 迪迦奥特曼 avatar Tony Peakman avatar  avatar 米可绫夏 avatar  avatar wjp avatar  avatar Letsmain avatar  avatar  avatar  avatar 开源GIT avatar  avatar idou85 avatar 呵呵 avatar 计算机毕业设计 avatar  avatar codeflying0817 avatar hdhaibqbx avatar Lujia Jin avatar  avatar  avatar Tingyour  avatar No Sugar or Tea avatar GitForGood avatar 大一学生 avatar 老实的切图Man avatar chenshuaibing avatar Ma Shiqing avatar Handsome avatar AiChatD avatar maozi avatar David Anderson avatar Yao Yao avatar whfay avatar 冰雪淇媛 avatar  avatar TellMeWhy1122 avatar zhanghao5683934 avatar  avatar  avatar  avatar  avatar Anon avatar Lex avatar  avatar a7 avatar  avatar  avatar  avatar  avatar 咸鱼 avatar KerwinChina avatar darrenwang avatar CR_Smile avatar  avatar Noodles avatar  avatar

Watchers

 avatar  avatar  avatar

erp's Issues

请教为什么返回都是404

为什么
/goods_categories/options/?page_size=999999&is_active=true
/goods_units/options/?page_size=999999&is_active=true
后台返回都是404

# yarn安装依赖包总是失败

===================nodejs使用12.13.1安装依赖的时候报的错误=====================

warning eslint > file-entry-cache > flat-cache > [email protected]: Rimraf versions prior to v4 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > [email protected]: Glob versions prior to v9 are no longer supported
[2/4] Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=18". Got "12.13.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

===================nodejs使用20.13.1的时候报的错误=====================
[2/4] Fetching packages...
error @achrinza/[email protected]: The engine "node" is incompatible with this module. Expected version "8 || 10 || 12 || 14 || 16 || 17". Got "20.13.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

===================nodejs使用12.13.1运行的时候报的错误=====================

INFO Starting development server...
98% after emitting CopyPlugin

ERROR Failed to compile with 1 error 11:09:50

This dependency was not found:

  • @/assets/avatar.png in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Headbar/Headbar.vue?vue&type=script&lang=js&

To install it, you can run: npm install --save @/assets/avatar.png

ddd

可以给我一个管理员的账号密码吗,我想登录上去试试

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.