An open API service indexing awesome lists of open source software.

https://github.com/kenmwaura1/pusher-realtime-table

Build a realtime table using Flask and Pusher Channels
https://github.com/kenmwaura1/pusher-realtime-table

flask pusher python3 sqlalchemy sqlite3

Last synced: about 2 months ago
JSON representation

Build a realtime table using Flask and Pusher Channels

Awesome Lists containing this project

README

          

# Build a realtime table using Flask and Pusher Channels

This is a demo application showing how to build a realtime table using Flask and Pusher.

## Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

### Prerequisites

This application uses the following:

- Python 3.6 (You should have python 3.6 or higher version installed)
- Pusher Channels (Create an account [here](https://dashboard.pusher.com/accounts/sign_up) or [login](https://dashboard.pusher.com/accounts/sign_in) here)
- JavaScript (jQuery)

### Setting up the project

First, clone this repository to your local machine:

```sh
$ git clone https://github.com/KenMwaura1/pusher-realtime-table.git
```

Next update the following keys in the `.env` file with your correct Pusher keys:
```
PUSHER_APP_ID=app_id
PUSHER_KEY=key
PUSHER_SECRET=secret
PUSHER_CLUSTER=cluster
```

Finally, update the placeholder - `` and `` with your correct Pusher Key in `/static/custom.js` file.

```javascript
const pusher = new Pusher('', {
cluster: '',
encrypted: true
});
```

### Running the App

To get the app running:

- From a command line, make sure you are in the project's root folder - `realtime-table`
- Create a virtual environment:
```
python3 -m venv env
```
- Activate the virtual environment:
```
source env/bin/activate
```
On windows? Activate it with the below:
```
env/Scripts/activate
```

- Install the dependencies:
```
pip install -r requirements.txt
```

- Finally run the app:
```
flask run
```

Congrats! The app should now be running on http://localhost:5000.

- Open your browser and fire up the app - http://localhost:5000/
- Then, open the backend page in another tab - http://localhost:5000/backend
- Next, add or update a flight. You would see the changes appear in realtime on the index page.

## Built With

* [Flask](http://flask.pocoo.org/) - A microframework for Python
* [Pusher](https://pusher.com/) - APIs to enable devs building realtime features