@anefta
Hi, yes i believe did run collectstatic:
(venv_referral) [marco@mydjangoserver django_referral]$ python manage.py collectstatic
You have requested to collect static files at the destination
location as specified in your settings:
/var/www/html/django_referral
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
Found another file with the destination path 'JS/searchAgents.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'JS/searchGrid.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'JS/baseTimeout.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'JS/searchQuotes.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'JS/reportSearch.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'JS/searchPolicy.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'images/LogoText.png'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'images/horizon.jpeg'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'images/waterSplash.jpeg'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'images/beach.jpeg'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'images/Swirl.png'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'images/LogoS.png'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'images/LogoGif.gif'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'images/LogoM.png'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'images/favicon.ico'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/addQuoteStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/viewAgentStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/quoteGridStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/gridStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/homeStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/agentProfileStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/navabrStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/prospectProfileStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/addPolicyStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/loginStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/addAgentStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/addProspectStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/declinedStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
0 static files copied to '/var/www/html/django_referral', 153 unmodified, 408 post-processed.
(venv_referral) [marco@mydjangoserver django_referral]$ deactivate
[marco@mydjangoserver django_referral]$ cd ..
[marco@mydjangoserver ~]$ cd domestic_voicelogging/
[marco@mydjangoserver domestic_voicelogging]$ source venv_voicelogging/bin/activate
(venv_voicelogging) [marco@mydjangoserver domestic_voicelogging]$ python manage.py collectstatic
You have requested to collect static files at the destination
location as specified in your settings:
/var/www/html/domestic_voicelogging
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
Found another file with the destination path 'JS/applicationScript.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'images/favicon.png'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'images/logo.png'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'images/Login.png'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'images/b1.png'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/homeStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/searchStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/applicationStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/reportStyle.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/login.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'CSS/claim.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
0 static files copied to '/var/www/html/domestic_voicelogging', 136 unmodified, 370 post-processed.
Changed the user from ‘nginx’ to ‘marco’. Getting 502 bad Gateway now:
(venv_voicelogging) [marco@mydjangoserver domestic_voicelogging]$ ls -l /run/gunicorn.sock
srw-rw----. 1 nginx www-data 0 Jul 9 09:37 /run/gunicorn.sock
(venv_voicelogging) [marco@mydjangoserver domestic_voicelogging]$ ls -l /run/django_referral.sock
srw-rw----. 1 nginx www-data 0 Sep 12 08:37 /run/django_referral.sock
(venv_voicelogging) [marco@mydjangoserver domestic_voicelogging]$ sudo chown marco:www-data /run/gunicorn.sock
sudo chown marco:www-data /run/django_referral.sock
[sudo] password for marco:
(venv_voicelogging) [marco@mydjangoserver domestic_voicelogging]$ ls -l /run/gunicorn.sock
srw-rw----. 1 marco www-data 0 Jul 9 09:37 /run/gunicorn.sock
(venv_voicelogging) [marco@mydjangoserver domestic_voicelogging]$ ls -l /run/django_referral.sock
srw-rw----. 1 marco www-data 0 Sep 12 08:37 /run/django_referral.sock
Changed it back to user ‘nginx’ and it works now don’t really know why …
@KenWhitesell
Update, this is my nginx config:
server {
listen 80;
server_name 41.76.110.165;
# Static files for Project 1
location /domestic_voicelogging/static/ {
alias /var/www/html/domestic_voicelogging/;
}
# Static files for Project 2
location /django_referral/static/ {
alias /var/www/html/django_referral/;
}
# Application requests for Project 1
location /voicelogging/ {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
# Application requests for Project 2
location /djangoprogram/ {
include proxy_params;
proxy_pass http://unix:/run/django_referral.sock;
}
# Handle favicon
location = /favicon.ico {
access_log off;
log_not_found off;
}
}
i am able to access both project through their url’s but it seem there is now a problem with the images but the css files are loaded.
Error log:
(venv_voicelogging) [marco@mydjangoserver domestic_voicelogging]$ sudo tail -f /var/log/nginx/error.log
2024/09/13 09:07:52 [error] 1497908#1497908: *45 open() "/usr/share/nginx/html/static/images/Login.png" failed (2: No such file or directory), client: 105.245.236.240, server: 41.76.110.165, request: "GET /static/images/Login.png HTTP/1.1", host: "41.76.110.165", referrer: "http://41.76.110.165/domestic_voicelogging/static/CSS/login.css"
2024/09/13 09:08:00 [error] 1497908#1497908: *48 open() "/usr/share/nginx/html/static/images/Login.png" failed (2: No such file or directory), client: 105.245.236.240, server: 41.76.110.165, request: "GET /static/images/Login.png HTTP/1.1", host: "41.76.110.165", referrer: "http://41.76.110.165/domestic_voicelogging/static/CSS/login.css"
2024/09/13 09:08:43 [error] 1497908#1497908: *49 open() "/usr/share/nginx/html/static/images/Login.png" failed (2: No such file or directory), client: 105.245.236.240, server: 41.76.110.165, request: "GET /static/images/Login.png HTTP/1.1", host: "41.76.110.165", referrer: "http://41.76.110.165/domestic_voicelogging/static/CSS/login.css"
2024/09/13 09:13:03 [error] 1497908#1497908: *63 open() "/usr/share/nginx/html/static/images/b1.png" failed (2: No such file or directory), client: 105.245.236.240, server: 41.76.110.165, request: "GET /static/images/b1.png HTTP/1.1", host: "41.76.110.165", referrer: "http://41.76.110.165/domestic_voicelogging/static/CSS/homeStyle.css"
2024/09/13 09:15:52 [error] 1498024#1498024: *3 open() "/usr/share/nginx/html/static/images/Login.png" failed (2: No such file or directory), client: 105.245.236.240, server: 41.76.110.165, request: "GET /static/images/Login.png HTTP/1.1", host: "41.76.110.165", referrer: "http://41.76.110.165/domestic_voicelogging/static/CSS/login.css"
2024/09/13 09:24:35 [error] 1498117#1498117: *4 open() "/usr/share/nginx/html/images/Login.png" failed (2: No such file or directory), client: 105.245.236.240, server: 41.76.110.165, request: "GET /images/Login.png HTTP/1.1", host: "41.76.110.165", referrer: "http://41.76.110.165/domestic_voicelogging/static/CSS/login.css"
2024/09/13 09:27:42 [error] 1498163#1498163: *1 open() "/usr/share/nginx/html/var/www/html/domestic_voicelogging/images/Login.png" failed (2: No such file or directory), client: 105.245.236.240, server: 41.76.110.165, request: "GET /var/www/html/domestic_voicelogging/images/Login.png HTTP/1.1", host: "41.76.110.165", referrer: "http://41.76.110.165/domestic_voicelogging/static/CSS/login.css"
2024/09/13 09:34:59 [error] 1498163#1498163: *6 open() "/usr/share/nginx/html/var/www/html/domestic_voicelogging/images/Login.png" failed (2: No such file or directory), client: 105.245.236.240, server: 41.76.110.165, request: "GET /var/www/html/domestic_voicelogging/images/Login.png HTTP/1.1", host: "41.76.110.165", referrer: "http://41.76.110.165/domestic_voicelogging/static/CSS/login.css"
2024/09/13 09:35:02 [error] 1498163#1498163: *4 open() "/usr/share/nginx/html/static/images/b1.png" failed (2: No such file or directory), client: 105.245.236.240, server: 41.76.110.165, request: "GET /static/images/b1.png HTTP/1.1", host: "41.76.110.165", referrer: "http://41.76.110.165/domestic_voicelogging/static/CSS/homeStyle.css"
2024/09/13 09:41:33 [error] 1498261#1498261: *3 open() "/usr/share/nginx/html/var/www/html/domestic_voicelogging/images/Login.png" failed (2: No such file or directory), client: 105.245.236.240, server: 41.76.110.165, request: "GET /var/www/html/domestic_voicelogging/images/Login.png HTTP/1.1", host: "41.76.110.165", referrer: "http://41.76.110.165/domestic_voicelogging/static/CSS/login.css"
^C
(venv_voicelogging) [marco@mydjangoserver domestic_voicelogging]$
i have this other nginx config under /nginx/sites-available/domestic_voicelogging:
server {
listen 80;
server_name 41.76.110.165;
location = /favicon.ico { access_log off; log_not_found off; }
location /domestic_voicelogging/static/ {
alias /var/www/html/domestic_voicelogging/;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
i checked the Css background image path and neither of these work after collectstatic:
background-image: url('/var/www/html/domestic_voicelogging/images/Login.png');
background-image: url('/static/images/Login.png');
i think the problem might be here in nginx -T config, the path we are seeing is here:
(venv_voicelogging) [marco@mydjangoserver domestic_voicelogging]$ sudo nginx -T
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# configuration file /etc/nginx/nginx.conf:
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
server_names_hash_bucket_size 64;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}