Coder Social home page Coder Social logo

python-socket-io's Introduction

Python backend, HTML5+Javascript with Material Design Lite front-end sample

Getting started

This code requires Python 3.7 and younger.

Before you start, you may want to setup the virtual environment for Python dependencies.

Setting up Virtual environment:

  1. pip install virtualenv
  2. python -m virtualenv venv
  3. execute venv\Scripts\activate.bat on windows or venv/Scripts/activate elsewhere

Install pre-requisites.

pip install -r requirements.txt

Start service

python main.py

If using Visual Studio Code, just start the debugger. The launch.json contains configuration that starts the Python service and then opens the page in Chrome and attaches to the javascript debugger there.

Initialize the page with observed data

Post this kind of message to http://localhost:5000/update:

{
    "Atomics": {
        "water_is_rising": true,
        "water_level": 50
    }
}

e.g. using Postman.

Page should display input elements according to type (boolean vs numeric).

Display a process

Post this kind of message to http://localhost:5000/startstop:

{
    "Action": "run_checklist",
    "Params": [{ "Name": "Quickly"}],
    "IsStopped": false,
}

The template index.html includes cards for action named run_checklist and stay_safe, but if you post any other action name, a dummy card is created on the fly.

Post "IsStopped": true to complete the action without waiting for the user.

The page should display cards with buttons to end the process.

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.