Giter Site home page Giter Site logo

tornado_web's Introduction

安装依赖库

# tornado 安装
pip install tornado

# mysql 数据库操作库
pip install Tornado-MySQL

mysql 数据库相关配置

  • config/database.py
Mysql_config = dict(
    driver='mysql',
    host='127.0.0.1',
    port=3306,
    database='blog',
    user='root',
    password='12345678',
)

启动

# 项目文件根目录下,执行
python __main__.py

# 或项目文件外一层,执行
python tornado_web

项目的基本结构是搭建完成了. 简单实现了首页列表和详情页的查询操作. mysql 数据库的操作还是不那么顺当,具体内容实现就暂时不实现了. 如果有像 php 的 laravel 有封装的那么好的数据库操作 api 就好了.

项目基本结构

root
├──config/                 * 相关配置文件(数据库,静态资源路径等)
├──controllers/            * 控制器集合,
├──databases/              * 数据库操作相关,数据库实例化函数等
├──models/                 * 数据模型操作
├──routes/                 * 路由的集中配置
├──static/                 * 静态资源目录
├──utils/                  * 公用工具包
├──views/                  * 视图模板文件集合
├──__main__.py             * 入口文件
└──entry.py                * 入口主要逻辑

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.