Skip to content

bluecolor/dash-skeleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plotly Dash Skeleton App

  • create user with cli
  • login
  • logout
  • home
  • change password
  • edit profile
  • logging
  • gunicorn gunicorn -w 4 "app:create_app()"
  • https gunicorn --certfile=server.crt --keyfile=server.key --bind 0.0.0.0:443 "app:create_app()"
  • caching
  • loading indicator
  • ldap integration

Usage

  • Create virtual environment
virtualenv -p python3 venv
  • Activate
. venv/bin/activate
  • Install dependencies
pip install -r requirements.txt
  • Setup database (tested with postgre and sqlite)

if you use sqlite

export APP_DATABASE_URL=sqlite:///dash.db

if you use postgre

export APP_DATABASE_URL=postgresql://dash:dash@localhost:5432/dash
  • Drop tables
python manage.py database drop-tables
  • Create tables
python manage.py database create-tables
  • Create user
python manage.py user create <name> <username> <password>
  • Run
chmod +x debug.sh
./debug.sh

Adding new sub-apps

Put new folders under app/pages/ext. Each added folder represents a sub application Each added folder must contain app.py file It will automacilly appear in "Applications" in navigation bar.

Basic example:

import dash_html_components as html
from app.pages import registery

# registery item props
#
# render: Render method
# name: Report name
# id: Report id, optional
# groups: [Report group]
# descripttion: Report description

def render():
    return html.Div([ html.H3('Hello') ])


item = {
    "render": render,
    "name": "Hello report",
    "id": "20",
    "groups": ["analytics", "ai"],
    "description": """My another awesome report"""
}

registery.register(item)

Additional settings

export DASH_TITLE=<title> # Browser Title
export DASH_BRAND=<brand> # Nav Brand

Enjoy.