NoLayoutException on deployment of multi page dash app example code



New to the forum. Love dash, but running into a multi-page deployment issue.

I am trying to recreate and deploy the sample multipage app from the user guide, deploying with Gunicorn+Nginx, but I run into the error below (actually ran into similar error on a apache+mod_wsgi deployment as well):

Aug 06 16:02:21 GunicornNginxFlask gunicorn[4415]: Traceback (most recent call last):
Aug 06 16:02:21 GunicornNginxFlask gunicorn[4415]: File “/home/andrew/myproject/myprojectenv/lib/python3.6/site-packages/flask/”, line 2292, in wsgi_app
Aug 06 16:02:21 GunicornNginxFlask gunicorn[4415]: response = self.full_dispatch_request()
Aug 06 16:02:21 GunicornNginxFlask gunicorn[4415]: File “/home/andrew/myproject/myprojectenv/lib/python3.6/site-packages/flask/”, line 1808, in full_dispatch_re
Aug 06 16:02:21 GunicornNginxFlask gunicorn[4415]: self.try_trigger_before_first_request_functions()
Aug 06 16:02:21 GunicornNginxFlask gunicorn[4415]: File “/home/andrew/myproject/myprojectenv/lib/python3.6/site-packages/flask/”, line 1855, in try_trigger_befo
Aug 06 16:02:21 GunicornNginxFlask gunicorn[4415]: func()
Aug 06 16:02:21 GunicornNginxFlask gunicorn[4415]: File “/home/andrew/myproject/myprojectenv/lib/python3.6/site-packages/dash/”, line 715, in _setup_server
Aug 06 16:02:21 GunicornNginxFlask gunicorn[4415]: ‘’
Aug 06 16:02:21 GunicornNginxFlask gunicorn[4415]: dash.exceptions.NoLayoutException: The layout was None at the time that run_server was called.

my wsgi file content is

from app import server as application
application.secret_key = ‘fj829082f84j29f8asdfj3298jfaksdnkdsnj’

my Systemd file is:

Description=Gunicorn instance to serve myproject

ExecStart=/home/andrew/myproject/myprojectenv/bin/gunicorn --workers 3 --bind unix:/home/andrew/myproject/myproject.sock -m 007 wsgi:application


and my Nginx goes to the correct socket:

proxy_pass http://unix:/home/andrew/myproject/myproject.sock;

The rest of the dash files come directly from the examples, with the same file structure:

  • apps

I can get the multipage app to work when it’s all within the same file (the page1/page2 example), but with the separate folders it becomes an issue

Does anyone know where or how I should begin troubleshooting this? I’ve looked at all the different parts (gunicorn, nginx, systemd, example code, etc…) and the relevant community posts and am stumped.

Any help appreciated, and thank you!


I had the same issue and in the end I fixed it by changing by adding this line:

from app import server

And then I switched the Procfile to this:

web: gunicorn index:server

I’m having the same issue. I’m running an application that I wrote on a windows 10 box.

What does the error mean and how do you fix it?


This issue is caused by the module that sets the layout of your Dash instance not being imported.

You need to make sure that the module you point your WSGI server (which contains the Flask server instance) at also sets the Dash layout or imports the module that sets the layout.

For example, given the project layout under the section “Structuring a Multi-Page App” within the Dash Docs you could try to point your WSGI server at the Flask instance attached to the Dash instance in (ie This would fail because the app module does not set the layout nor does it import the module that does. Instead you would point your WSGI server at


I’m having the same issue and the layout for multi-page app from the docs, as you point out if I point the WSGIs-server(gunicorn) to app:server I get no layout exception, when pointing it to index:server or or index:app.server then nothing at all happens.

If I restructure the content within the files a bit, so move the app.layout from to and point gunicorn to app:server then it works BUT only static content no dynamic content renders.

this is driving me nuts!

Any suggestions?


Pointing your WSGI server at index:app.server should work, and I just tested it myself to confirm. When you say “nothing at all happens”, can you be more specific?

Is there no terminal output, or nothing happen when you navigate to a page in the browser?

You should be able to visit http://localhost:8000/apps/app1 in your browser. (Adjusting for the right port/host values)


“nothing at all happens” I guess it was stuck in a loading loop of some kind, I tried waitress WSGI-server and then is worked, so I swapped and am a happy camper now!


1 Like

In case others stumble upon this and are confused - @nedned I think you accidentally posted two different solutions above and one has a misplaced period and semicolon.

:white_check_mark: index:app.server worked for me .

:no_entry_sign: did not work and returned ModuleNotFoundError.

In full, for multi-page apps following the tutorial example structure:

gunicorn index:app.server
1 Like

Oops, good catch!

Unfortunately, I can’t edit the post as it’s been too long since posting it.