I'm trying to deploy a django project with uWSGI and nginx. I have the next configuration files:
uwsgi.ini
[uwsgi]
#Django-related settings
chdir = /home/amlalchy/api_aml_platform
module = api.wsgi
#static-map = /static=/home/amlalchy/api_aml_platform/services/static
#Process-related settings
master = true
processes = 10
# The socket(use the full path to be safe)
socket = /tmp/aml.sock
chmod-socket = 664
uid = www-data
gid = www-data
# Clear environment on exit
vacuum = true
uwsgi.service
[Unit]
Description=uWSGI Emperor service
After=network.target
[Service]
#User=amlalchy
#Group=www-data
ExecStartPre=/bin/bash -c 'mkdir -p /run/uwsgi; chown amlalchy:www-data /run/uwsgi'
ExecStart=/bin/bash -c 'cd /home/amlalchy/api_aml_platform && source /home/amlalchy/anaconda3/bin/activate AmlPlatform && uwsgi --ini /etc/uwsgi/sites/uwsgi.ini'
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all
[Install]
WantedBy=multi-user.target
api.conf for the nginx configuration
server {
listen 80;
server_name server.prueba.com;
charset utf-8;
client_max_body_size 128M;
location = /favicon.ico { access_log off; log_not_found off; }
location /static {
root /home/amlalchy/api_aml_platform/services;
}
location /media {
root /home/amlalchy/api_aml_platform;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/aml.sock;
uwsgi_read_timeout 300s;
uwsgi_send_timeout 300s;
}
}
I'm getting this error in /var/log/enginx/error.log
:
2020/01/13 10:30:12 [error] 12641#12641: *1 open() "/home/amlalchy/api_aml_platform/services/static/css/global.css" failed (2: No such file or directory), client: 127.0.0.1, server: server.prueba.com, request: "GET /static/css/global.css HTTP/1.1", host: "127.0.0.1", referrer: "http://127.0.0.1/api/login/
I am newbie and I don't know what I'm missing because the static files exists... so I would be really grateful for any tip on my error.
Thanks in advance.
Where are your static files (css/js/images)? How do you deploy them? As @ruddra suggested, how do you run your?
./manage.py collectstatic
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.