使用uwsgi启动ini的时候,mysite_uwsgi.ini中的socke是什么作用?
问题1:mysite_uwsgi.ini
中配置的socket指向的mysite.sock文件会在uwsgi --ini mysite_uwsgi.ini
时进行创建,但结束后就被remove了,所以怎么对这个sock进行配置?
问题2:mysite_uwsgi.ini这个mysite.sock文件跟mysite_nginx.conf里面upstream django下面的server的sock有什么区别么?都有什么作用?
问题3:我在访问url为:http://mysite-py.local:8000/media/media.png
的时候具体访问路径为:/www/Code/python/mysite/mysite/media/media.png,但是访问http://mysite-py.local:8000
的时候按理说应该转到Django中配置的/www/Code/python/mysite/mysite.sock
中,不过显示Internal Server Error
刚入django坑,请各位大神耐心指教~多多包涵~
运行环境是:python3.6,nginx,uwsgi
下面是我的mysite_nginx.conf
# mysite_nginx.conf
# the upstream component nginx needs to connect to
upstream django {
server unix://www/Code/python/mysite/mysite.sock; # for a file socket
#server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 8000;
# the domain name it will serve for
server_name mysite-py.local; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /www/Code/python/mysite/mysite/media; # your Django project's media files - amend as required
}
location /static {
alias /www/Code/python/mysite/static; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /www/Code/python/mysite/config/uwsgi_params; # the uwsgi_params file you installed
}
}
下面是我的mysite_uwsgi.ini:
# mysite_uwsgi.ini file
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /www/Code/python/mysite
# Django's wsgi file
module = mysite.wsgi
# the virtualenv (full path)
#home = /path/to/virtualenv
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 10
# the socket (use the full path to be safe
#socket = 127.0.0.1:8001
socket = /www/Code/python/mysite/mysite.sock
# ... with appropriate permissions - may be needed
chmod-socket = 666
# clear environment on exit
vacuum = true
logto = /www/Code/python/mysite/uwsgi.log
~
下面是我的hosts文件:
127.0.0.1 mysite-py.local
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论