uwsgi

uwsgi部署django项目

风格不统一 提交于 2019-12-25 22:26:27
一、更新系统软件包 yum update -y 二、安装软件管理包及依赖 yum -y groupinstall "Development tools" yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel 三、yum安装python36 yum install -y python36 python36-devel yum安装报错修改epel.repo 四、pip3 python36安装时默认安装pip3 yum install -y pip3 pip install django==1.11.8 pip install pymysql pip install requests 将django项目拷贝至/www/目录下,测试项目运行是否正常,运行以下命令: python3 ./manage.py runserver 127.0.0.1:8000 五、pip安装uwsgi pip3 install uwsgi /www/project根目录下创建Django项目名myDjango的myDjango.xml文件,内容为: <uwsgi> <socket>127.0.0.1:8001</socket><!-- 内部端口,自定义 --> <chdir>/www

django+nginx+uwsgi 部署配置

社会主义新天地 提交于 2019-12-25 22:26:15
django官方文档在这 https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/uwsgi/ 第一步:先收集静态文件 之前要先设置 STATIC_ROOT = os.path.join(BASE_DIR,'static') 然后执行命令 python manage.py collectstatic 第二步:配置nginx server { server_name qq.com; location /static{ #location 与STATIC_URL一致 #alias 与STATIC_ROOT一致 alias /var/www/qq.com/static; } location / { #与之后uwsgi配置一致 proxy_pass http://127.0.0.1:8000/; } } 第三步:配置uwsgi.ini [uwsgi] chdir=/var/www/qq.com uid=www-data gid=www-data module={{projectname}}.wsgi:application socket=127.0.0.1:8000 protocol=http master=true workers=5 pidfile=/var/www/qq.com/uwsgi.pid vacuum

Django部署uwsgi 与 nginx配置

风格不统一 提交于 2019-12-25 22:26:06
1、nginx文件的配置 路径:/etc/nginx/conf.d/ example.conf 启动:service nginx [start]/[restart]/[stop] upstream django { # server unix:///path/to/your/mysite/mysite.sock; # for a file socket server 127.0.0.1:8000; # for a web port socket (we'll use this first) } # configuration of the server server { # the port your site will be served on listen 8080; # the domain name it will serve for server_name django; # substitute your machine's IP address or FQDN charset utf-8; # max upload size client_max_body_size 75M; # adjust to taste # Finally, send all non-media requests to the Django server. location / { uwsgi

nginx,uwsgi,部署django,静态文件不生效问题

余生长醉 提交于 2019-12-25 22:25:28
打开浏览器,然后访问服务器,如果能够正常访问,并且页面链接可以跳转,但是页面却是乱的,那一定是nginx.conf里面的静态文件配置不正确, location /static/ { #expires 30d; #autoindex on; #access_log off; #add_header Cache-Control private; root /root/project/; } #比如我的项目在/root/project/,这里面包含manage.py还有很多app,然后我们需要在settings.py文件增加STATIC_ROOT = os.path.join(BASE_DIR, "static"), STATICFILES_FINDERS = ( "django.contrib.staticfiles.finders.FileSystemFinder", "django.contrib.staticfiles.finders.AppDirectoriesFinder" ) 其他的不改动,然后在服务器中的/root/project/目录新建文件夹static,运行python3 manage.py collectstatic,会将所有app中的static中的静态文件拷贝到当前目录static中,留作nginx使用,收集之后,我们需要重启nginx,然后再启动uwsgi

bottle uwsgi nginx app returns 404

泄露秘密 提交于 2019-12-25 12:24:30
问题 OK, I've gone around and around on this and don't know what else to do: maybe someone can help. I'm trying to run a bottle app via uwsgi and nginx. It works fine if I run it with the bottle server, like this; python app.py and then point a browser to hostname:8080 but when run via nginx/uwsgi, and go to: hostname/apps/app1 I get the 404 error handler WITHIN THE APP, which reports a 404 error. So it's running the app: it just doesn't seem to match any of the route "decorators". Here's the app

bottle uwsgi nginx app returns 404

只愿长相守 提交于 2019-12-25 12:23:49
问题 OK, I've gone around and around on this and don't know what else to do: maybe someone can help. I'm trying to run a bottle app via uwsgi and nginx. It works fine if I run it with the bottle server, like this; python app.py and then point a browser to hostname:8080 but when run via nginx/uwsgi, and go to: hostname/apps/app1 I get the 404 error handler WITHIN THE APP, which reports a 404 error. So it's running the app: it just doesn't seem to match any of the route "decorators". Here's the app

nginx ignores view permissions when serving media files from django

╄→гoц情女王★ 提交于 2019-12-25 10:33:11
问题 I have the following setup: nginx.conf # the upstream component nginx needs to connect to upstream django { server unix:///tmp/project.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 .example.com; # substitute your machine's IP address or FQDN charset utf-8; # max upload size client_max_body_size 75M; #

Linode Django uwsgi Nginx

心不动则不痛 提交于 2019-12-25 09:18:22
问题 The following setup is only letting me see the default Nginx html page. How can I get to Django? I've been following Linode's documentation on how to set this up (and numerous other tutorials), but they don't use systemd, so things are a bit different. https://www.linode.com/docs/websites/nginx/deploy-django-applications-using-uwsgi-and-nginx-on-ubuntu-14-04 I am using Linode with Fedora24. I have installed my virutalenv at /home/ofey/djangoenv and activated it, Django is installed using pip

Django uwsgi Nginx not serving media files

三世轮回 提交于 2019-12-25 03:44:51
问题 Edit: I've made some progress trouble shooting this issue. For an update on the situation, read the comments and view this post on ServerFault: https://serverfault.com/questions/690836/django-uwsgi-nginx-not-serving-media-files-django-returns-404-status-code?noredirect=1#comment851441_690836 I'm following this tutorial: http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html Everything was going well until I reached the "Basic nginx test" section. When I stopped and

How can I redirect HTTPS to HTTP with uWSGI internal routing?

无人久伴 提交于 2019-12-25 03:16:35
问题 For some reasons, I need to force HTTP for my whole site. At first, I thought that i could simply interchange key-parameters such as those shown in uwsgi-docs.readthedocs.io#Force HTTPS How can I redirect HTTP to HTTPS with uWSGI internal routing? leading me to do: plugins = router_redirect route-if-not = equal:${HTTP};on redirect-permanent:http://${HTTP_HOST}${REQUEST_URI} which does not work. Hence the following question: How can I redirect HTTPS to HTTP with uWSGI internal routing? Note