No permission to access the requested resource on POST requests in mixed Flask-Dash application

Dear all,
I am trying to create a multipage site using mixed flask and dash pages.
However, if I add dash pages, I cannot handle post request from the flask ones anymore, getting the error:


You don’t have the permission to access the requested resource. It is either read-protected or not readable by the server.

Uncommenting the last lines in the following code you ca replicate the error.

from flask import Flask
from flask import request
import dash
import dash_core_components as dcc
import dash_html_components as html
import logging

server = Flask(“my app”)

def hello():
return ‘Main’

@server.route(’/postExample’, methods=[‘GET’, ‘POST’])
def post_request():
if request.method == ‘POST’:
logging.debug(“Post request!”)
return "hello world"
logging.debug(“not a post request”)

return '''
<!doctype html>
<title>Upload File</title>
<h1>Upload a File</h1>
<form method="post" enctype="text/plain">
Input: <input type="text" name="var1"><br>
<input type="submit" value="Submit">

app3 = dash.Dash(name=‘Dash’, server=server, url_base_pathname=’/dashExample’)

app3.layout = html.Div([



Could you try setting the server’s secret_key?
server.secret_key = os.environ.get('secret_key', 'some-default-secret-key')

where 'some-default-secret-key` is the output of

>>> import binascii
>>> binascii.hexlify(os.urandom(24))