Giter Site home page Giter Site logo

itrace_startup_in_python's Introduction

itrace_startup_in_python

2017 itrace startup in python

安装 pip

Python的第三方包依赖需要通过 pip 安装: 因此,我们在部署环境上需要先安装好pip,并安装第三方类库。Python2.x版本是没有自带pip 的:

$ wget https://bootstrap.pypa.io/get-pip.py
$ su - root  # 切换到 root 用户
# python get-pip.py

选拔赛题目二:

运行:

$ pip install Flask
$ python section02.py

ORM 集成

集成了 SQLAlchemy 包,是 Python 语言的一个 ORM 包,支持多种数据库。

安装

$ pip install SQLAlchemy flask-sqlalchemy pymysql
$ python section02.py

用到的 Cust 表结构

section02.py 里面用到的是 cust表,其表结构和数据如下:

CREATE TABLE `cust` (
  `cust_id` bigint(20) NOT NULL,
  `area_id` int(11) DEFAULT NULL,
  `create_date` datetime DEFAULT NULL,
  `cust_group_id` bigint(20) DEFAULT NULL,
  `cust_name` varchar(255) DEFAULT NULL,
  `cust_number` varchar(255) DEFAULT NULL,
  `update_date` datetime DEFAULT NULL,
  PRIMARY KEY (`cust_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


insert into cust (cust_id, area_id, create_date, cust_group_id, cust_name, cust_number, update_date) values (1001, 200, "2017-09-04 19:59:29", 10010, "itsyc", "233", "2017-09-04 19:59:29");
insert into cust (cust_id, area_id, create_date, cust_group_id, cust_name, cust_number, update_date) values (1002, 200, "2017-09-04 19:59:29", 10011, "张三", "2233", "2017-09-04 19:59:29");

例子接口: http://127.0.0.1:5000/cust/get

参考材料

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.