Mirco
😓😓 As I told you before, I still don't have so much experience So you need someone more expert than me like @JimmySan or anyone else here more expert about deployment
Rohan
I use gunicorn + nginx for deployment
Rohan
And supervisord for daemonising
Leonardo
Rohan
https://jee-appy.blogspot.com/2017/01/deply-django-with-nginx.html?m=1
Leonardo
https://jee-appy.blogspot.com/2017/01/deply-django-with-nginx.html?m=1
I'll launch another machine and try it, thank you very much
Rajjix
https://jee-appy.blogspot.com/2017/01/deply-django-with-nginx.html?m=1
good guide very detailed you should add it to the pinned message, as deployment is a main part of django
inchidi
work already? try open the source and follow any of your static file link
Jimmies San
Jimmies San
check permissions
Jimmies San
look the f12 bar on chrome during the loading
Jimmies San
check static error
Jimmies San
fix where neeeded
Leonardo
check permissions
sudo chmod -R 755 /home/ubuntu/ambiente_er/* ?
Jimmies San
no
Jimmies San
usermod -a -G ambiente_er nginx
Jimmies San
nginx user is nginx or www-data: if amazonlinux/centos is nginx
Leonardo
its ec2
Jimmies San
its ec2
ok, so nginx
Jimmies San
Leonardo have you activated the nginx configuration? i mean
Jimmies San
you have to put it on etc/nginx/conf.d or inside sites-available and then link to sites-enables, it depends from your config tree
Leonardo
i did everything with that guide https://medium.com/@srijan.pydev_21998/complete-guide-to-deploy-django-applications-on-aws-ubuntu-16-04-instance-with-uwsgi-and-nginx-b9929da7b716
Leonardo
idk what's the next setp
Jimmies San
wait i'm reading
Jimmies San
do you setup the uwsgi server for your app inside home user?
Jimmies San
you run it without root, but using the user ambiente_er ... right?
Leonardo
Jimmies San
let me see your wsgi file
Jimmies San
yep :)
Leonardo
let me see your wsgi file
https://pastebin.com/JHx7tjUU
Jimmies San
https://pastebin.com/JHx7tjUU
chown-socket = ubuntu:www-data
Jimmies San
your are not on ubuntu and your user is not ubuntu so change it to
Jimmies San
chown-socket = ambiente_er:nginx
Leonardo
my user is ubuntu
Jimmies San
the user of the app
Leonardo
look
Leonardo
no
Jimmies San
the app is inside home ambiente_er
Leonardo
ambiente_er is the main app folder
Leonardo
inside has virutalenv, and src app folder
Jimmies San
yes, and you want that each app runs with its user
Leonardo
no, is inside /home/ubuntu/ambiente_er/src
Jimmies San
mmmmh
Jimmies San
that's dirty
Leonardo
ubuntu@ip-172-31-85-43:~/ambiente_er$ pwd /home/ubuntu/ambiente_er ubuntu@ip-172-31-85-43:~/ambiente_er$ ls ambiente_er.sock bin include lib pip-selfcheck.json src static_cdn ubuntu@ip-172-31-85-43:~/ambiente_er$
Jimmies San
sorry can you do a uname -a ?
Leonardo
ubuntu@ip-172-31-85-43:~/ambiente_er$ uname -a Linux ip-172-31-85-43 4.15.0-1021-aws #21-Ubuntu SMP Tue Aug 28 10:23:07 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux ubuntu@ip-172-31-85-43:~/ambiente_er$
Jimmies San
it's an ubuntu machine, not amazon linux
Leonardo
yes
Leonardo
ec2
Jimmies San
so you need to change nginx to www-data
Leonardo
commandline example please?
Jimmies San
ec2
yes but ec2 by default is amazonlinux based on centos, and for me was AL, not ubuntu
Jimmies San
usermod -a -G ubuntu www-data
Leonardo
ok
Leonardo
did
Leonardo
and now?
Jimmies San
have you configured the uwsgi daemon, yes? on systemd
Jimmies San
nginx settings: https://pastebin.com/Wvghtmb2
and here you have location = /static_cdn/ { root /home/ambiente_er/static_cdn; } but is not correct
Jimmies San
root home ubuntu ambiente_er ...
Jimmies San
this is why i thought about ambiente_er as a user :D
Leonardo
yeah i got your point
Leonardo
i just made a folder to virtualenv and my project
Jimmies San
no proble, is a test
Jimmies San
so you can see how
Leonardo
i don't like to just throw everything on user path
Jimmies San
the next one you will do with best practice :)
Jimmies San
i just made a folder to virtualenv and my project
i use a user per app, every app its home, its user, its db, its vhost
Leonardo
uwsgi.service file: https://pastebin.com/raMpFHL3
Jimmies San
uwsgi.service file: https://pastebin.com/raMpFHL3
ok, have you enable/start it? errors?
Leonardo
sure thing, no errors
Leonardo
but what's the problem now?
Jimmies San
sure thing, no errors
on nginx the line 3
Leonardo
since nginx is ok?
Jimmies San
server_name server_domain_or_ip;