Simple sample project to showcase real time data generation with Django and DRF using Django Channels, this data is then used to plot different real time charts with Charts JS and bootstrap in the front-end. The charts include Bar chart, Pie Chart and Line chart. .
Features:
Up-to-date dependenciesStack: DjangoAPIvia DRFWebprotocolHttp & WebsocketCharts: Chart.jsStyling: BS5 (via CDN)
> 👉 **Image**
👉 Clone Sources (this repo)
$ git clone https://github.com/app-generator/sample-django-real-time-charts/ $ cd sample-django-real-time-charts>> git clone https://github.com/app-generator/sample-django-real-time-charts/ >> cd sample-django-real-time-charts👉 Install Modules using a Virtual Environment
$ virtualenv env $ source env/bin/activate $ pip3 install -r requirements.txtOr for Windows-based Systems
$ virtualenv env $ .\env\Scripts\activate $ $ # Install modules - SQLite Database $ pip3 install -r requirements.txt> 👉 **Image**
👉 **Download redis**
Get the latest version of redis from https://redis.io/download and follow the installation guides, after installation run redis-server to start redis server.
Or for Windows-based Systems
On windows, you'll need to get latest redis cli from https://github.com/tporadowski/redis, click to download latest reddit package, then doble click on the redis file and open in file explorer after to install, type c:\program files\redis on the explorer search bar and click on redis-cli.exe and your redis server is opened already.
👉 Migrate Database
$ python manage.py makemigrations $ python manage.py migrate $ python manage.py runserver👉 Create Superuser
$ python manage.py createsuperuser👉 Start the APP
$ python manage.py runserverThe bootstrap flow
- Access the
adminsection- Load
data/users.csvin users table (using import/export feature) - Load
data/products.csvin users table (using import/export feature)
- Load
- Access the HOMEpage
- Charts should be displayed with data
Navigations
- Access all api at
localhost:8000/all/ - Add new instance to the Product model at
localhost:8000/create/

