I have a dash app that I built and I am trying to host it on my server using Nginx and Gunicorn and while it works by going to www.site.com:5055 , it does not work going to www.site.com/dash/ for example. Basically the page stays stuck on Loading and in the developer tools I’m seeing failing to load resources such as dash_renderer.v1_2_2m1574885976.min.js and many more. So I’m not really sure what is going on here? If I’m missing something in my Nginx file. Thanks!
This is a shortened version of the application I got and it still isn’t working as its supposed to. IT works on www.site.com:5055/crm but not www.site.com/crm which I don’t get. It still saying Loading… and stays stuck on there. When I go into the developer tools it says failed to load a bunch of resources.
import dash
import dash_core_components as dcc
import dash_html_components as html
import os
import pymysql as sql
from dash.dependencies import Output, Input
import json
import pandas as pd
import flask
# Read in db credentials from confif.json
json_file = open("config.json", "r")
config = json.load(json_file)
server = flask.Flask(__name__)
app = dash.Dash(__name__, server=server, url_base_pathname="/dash/")
# Define Layout of the dashboard
app.layout = html.Div([
html.Div(className="title", children=[
html.Link(
href="https://fonts.googleapis.com/css?family=Saira&display=swap", rel="stylesheet"),
html.P(id="dash-title", children="CRM Dashboard")
]),
])
@server.route("/crm")
def render_dash():
return flask.redirect("/dash/")
if __name__=="__main__":
app.run_server(port=5000, host="0.0.0.0", debug=True, use_reloader=True)
I tried running it without Supervisor and it still giving me the same issue when I go to www.mysite.com/crm and it just stays stuck on loading. It wants to load but something is preventing the rest of the resources from loading. This is what I ran below and port 5055 is opened in the firewall settings. As for resources I got a folder called assets and in there I just have css file.
I tried that as well and its still failing to load. I might try this out on another VM site and see if I still get the same error. It could be my nginx configuration.
I looked back through my notes for configuring Gunicorn/NGINX and found that I had to run the following terminal command before NGINX would work. This will “Allow HTTPD scripts and modules to connect to the network”.
Oh. Looks like the selinux-policy-default package isn’t included with Ubuntu by default. I’m running RHEL, so I had to run that command before NGINX would work properly. That said, I’m not sure what else to check. May need to up the logging levels for Gunicorn and NGINX for review.