GithubHelp home page GithubHelp logo

central-air-conditioning's Introduction

后台

Flask + MySQL

Installation

  1. fork项目至本地目录并随时更新进度.
  2. 配置Python3.6环境, 推荐使用Miniconda. 配置教程

Build Setup

cd bupt-air-backend

# 安装依赖
pip install -r requirements.txt

# 测试数据库连接情况
python model.py

# 运行开发服务器
export FLASK_ENV=development
flask run

生产环境部署

cd bupt-air-backend

# gunicorn
gunicorn --threads 16 app:app

# Nginx

server {
    listen 80;
    server_name example.org;
    access_log  /var/log/nginx/example.log;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
  }

Tip

  1. Flask 官方教程
  2. 负基础Flask入门

ORM

peewee is a small, expressive orm -- supports postgresql, mysql and sqlite

官方文档

减少重复轮子

主机部分

类名:mainMachine

属性:
	main_status = 1  # 表示主机状态,制冷1、制热2
    is_standby = 1     # 记录是否待机,待机1、运行0
    num = 3     # 每秒最多处理请求数目,默认为3条
    n = 3       # 这一秒内还能接收n条请求
    choice = 3  # 调度算法选择,随机1、先来先服务2、风速优先3
    
    requestList = []    # 这一秒的请求列表
    responseList = []   # 这一秒要处理的请求列表
不间断处理函数:
run(self)
对外方法:
set_status(self, status)      # 设置主机状态

set_number_request(self, number)   # 设置每秒处理的请求数目

set_schedule(self, choice)        # 设置调度类型

central-air-conditioning's People

Contributors

happydogyun avatar

Stargazers

 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.