Hello,
I have tried @Hoxbro approach to make my panel visible inside Django once deployed with nginx. I created 2 servers with 2 different nginx and 2 different supervisor conf files. With this Panel server configuration, both servers seem to be up now, and several components of Bokeh are loaded (previously not) as one can be seen in the following pictures.
I allowed to access Bokeh server from different origins just to debug, and if I enter “http://192.168.199.13:5500/app1” where Panel server is started some modules load but nothing is visible (next picture).
The way I have configured nginx conf files is the following:
django.conf
# Default server configuration
#
server {
listen 80 default_server;
server_name _;
access_log /tmp/bokeh.access.log;
error_log /tmp/bokeh.error.log debug;
location = /favicon.ico { access_log off; log_not_found off; }
location / {
proxy_pass http://192.168.199.13:8000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
proxy_buffering off;
}
}
panel.conf
# Default server configuration
#
server {
#listen 80 default_server;
#server_name _;
access_log /tmp/panel.access.log;
error_log /tmp/panel.error.log debug;
location = /favicon.ico { access_log off; log_not_found off; }
location /app1/ {
proxy_pass http://192.168.199.13:5500;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
proxy_buffering off;
}
}
Supervisor config files are:
django.conf
[fcgi-program:asgi]
# Set Django environment variables
# TCP socket used by Nginx backend upstream
socket=tcp://192.168.199.13:8000
# Directory where your site's project files are located
directory=/home/toni/Documentos/071/mysite
# Each process needs to have a separate socket file, so we use process_num
# Make sure to update "mydjangoproject.asgi" to match your project name
command=/home/toni/bin/anaconda3/envs/panel/bin/daphne -u /run/daphne/daphne%(process_num)d.sock --fd 0 --access-log - --proxy-headers mysite.asgi:application
# Number of processes to startup, roughly the number of CPUs you have
numprocs=4
# Give each process a unique name so they can be told apart
process_name=asgi%(process_num)d
# Automatically start and recover processes
autostart=true
autorestart=true
# Choose where you want your log to go
stdout_logfile=/var/log/asgi.log
redirect_stderr=true
panel.conf
[program:panel]
socket=tcp://192.168.199.13:5500
# Directory where your site's project files are located
directory=/home/toni/Documentos/071/mysite/display
# Each process needs to have a separate socket file, so we use process_num
# Make sure to update "mydjangoproject.asgi" to match your project name
#command=/home/toni/bin/web_env/env/bin/panel serve app1.py --address 192.168.199.13 --port 5500 --allow-websocket-origin 192.168.199.13:8000
command=/home/toni/bin/web_env/env/bin/panel serve app1.py --address 192.168.199.13 --port 5500 --allow-websocket-origin='*'
# Automatically start and recover processes
autostart=true
autorestart=true
startretries=3
user=nobody
# Choose where you want your log to go
stdout_logfile=/var/log/panel.log
redirect_stderr=true
Whole project with new changes can be found in:
Does anybody knows what address, socket or item in my configuration is not properly configured?
Thanks in advance