Code Monkey home page Code Monkey logo

opman-django's Introduction

OpMan2.0

运行环境介绍

系统:Mac

软件:Python3.6,Django1.11.3,MySQL5.7

注意:此项目尚未开发完整,尚不能部署线上使用,仅供学习,弱要看效果修改setting文件改成debug模式直接run起来就行,忽略下面的ngx配置(高手可无视)

docker容器镜像部署: 请查看docker_deploy.md 文档发说明

全新UI

部署方法

  • 创建uwsgi,nginx进程运行的用户

useradd opman

  • 安装MySQL5.7,并设置my.cnf

character-set-server = utf8

character-set-client-handshake = FALSE

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER

  • 登录MySQL,并授权项目账号

GRANT ALL PRIVILEGES ON devop.* TO dbuser_op@'%' IDENTIFIED BY 'devop@2015***';

  • MySQL连接配置在opman-django/devop/settings.py

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'devop', 'USER': 'dbuser_op', 'PASSWORD': 'devop@2015***', 'HOST': 'localhost', 'PORT': '', } }

  • 安装Redis

https://niubilety.com/redis%E5%85%A5%E9%97%A8%E4%B8%80/

  • 执行ansible如果用密码的方式需要安装sshpass 命令

yum install sshpass -y

  • 克隆代码

cd /data/webroot

git clone https://github.com/hgz6536/opman-django.git

cd opman-django && pip3 install -r requirements.txt

  • 初始化项目

python manage.py makemigrations opman

python manage.py migrate

python manage.py createsuperuser

  • 导入样例数据

python manage.py loaddata initdb/opman.json

  • 启动celery worker进程

/usr/bin/python manage.py celery worker --loglevel=info -E -c 2 &

  • 安装uwsgi

pip3 install uwsgi

  • nginx配置文件

upstream opman {

    server 127.0.0.1:8000;

}

server {

    listen 80;
    server_name opman.niubilety.com
    charset utf-8;

    gzip on;
    gzip_min_length 1000;
    gzip_buffers 4 16k;
    gzip_http_version 1.1;
    gzip_comp_level 3;
    gzip_vary on;

    client_max_body_size 8M;

    #access_log /data/logs/nginx/opman_access.log;
    #error_log /data/logs/nginx/opman_error.log;

    location /medis {
            alias /data/webroot/opman-django/media;
    }

    location /static {
            alias /data/webroot/opman-django/static;
    }

    location / {
            uwsgi_pass opman;
            include /etc/nginx/uwsgi_params;
    }

}

  • 启动uwsgi

uwsgi --ini /data/webroot/opman-django/uwsgi.ini

  • 平滑重启uwsgi

uwsgi --reload /tmp/opman.pid

  • 启动nginx

/etc/init.d/nginx start

** 要注意的 如果前端的图标访问不了,只需要在nginx配置 /static/ 路径中加入如下参数

        add_header Access-Control-Allow-Origin opman.itcp.cc;
        add_header Access-Control-Allow-Credentials 'true';
        add_header Access-Control-Allow-Headers X-Requested-With;
        add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

本项目交流群

580838402

如果困惑直击QQ 点击这里给我发消息

扫个红包以表支持

土豪可直接现金支持

opman-django's People

Contributors

hgz6536 avatar itcp avatar angelauncle avatar

Watchers

James Cloos avatar  avatar

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.