How to organize a story project?

I am trying to understand how to organize a dash project with multiple applications. All examples are single-page applications, and I want several dashes to be organized as a single project to be launched using a gun (inside the docker container):

dash-project/
  app1/
     layout.py
     data.py
  app2/
     layout.py
     data.py
  run.py( or run.sh)

Is this the right way? What should be inside run.pyor run.shif something? How to use gunicorn to serve multiple applications?

+4
source share
1 answer

With the latest (main) version of the dash, you can create a project with several applications!

Structure

dash-project/
  app1/
     app.py
     datamodel.py
  app2/
     app.py
     datamodel.py
  mycomponents/
     ...
  server.py
  run.py

app1 / app.py:

import dash
import app1.datamodel
..
from server import server

app = dash.Dash(name='app1', sharing=True, 
                server=server, url_base_pathname='/app1')

server.py

from flask import Flask
server = Flask(__name__)

run.py

from server import server as application

import app1.app
import app2.app    

Serve using uwsgi (can be easily used for nginx)

uwsgi --http 0.0.0.0:5000 --processes 4 --wsgi-file run.py
+3
source

Source: https://habr.com/ru/post/1680057/


All Articles