gunicorn

gunicorn not serving static files

天大地大妈咪最大 提交于 2019-12-07 04:26:30
问题 I've been working on serving a Django app from an Ubuntu server. I've followed all of the instructions in http://senko.net/en/django-nginx-gunicorn/, but when I get to the gunicorn_django -b 0.0.0.0:8000 step, the site suddenly stops serving static files. The site works just fine using the dev server python manage.py runserver 0.0.0.0:8000 . I haven't changed the stock settings for anything. Any ideas why this is not working? EDIT: After following the rest of the tutorial and the advice of

Change header 'Django administration' text on nginx

好久不见. 提交于 2019-12-07 04:10:31
问题 I followed this question's answers to change my django admin panel title header. I tried this: There is an easy way to set admin site header - assign it to current admin instance in urls.py like this admin.site.site_header = 'My admin' But it just works when I'm running the page via Python manage.py runserver My question is how can I change the admin title header when I'm running the site via gunicorn and nginx 回答1: writing this code at the bottom of urls.py somehow worked: admin.site.site

set up pipenv with supervisor

只谈情不闲聊 提交于 2019-12-06 23:47:24
问题 I want to deploy dev server but I have a problem with starting celery and gunicorn. I'm using scripts for my purposes celery.sh #!/bin/bash cd /home/dev/app pipenv run celery -A config worker -B -l info and start.sh for gunicorn #!/bin/bash cd /home/dev/app pipenv run gunicorn config.wsgi:application -b 127.0.0.1:8005 -w 2 -t 60 \ --env DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE \ --env DSN=$SENTRY_DSN \ --env DATABASE_URL=$DATABASE_URL \ --log-file - \ --error-logfile /home/dev/app

Timeout when uploading a large file?

懵懂的女人 提交于 2019-12-06 19:32:02
问题 I am running a Django app on a Linux platform with gunicorn and Nginx. I allow users to upload a CSV file (approx 2MB) which the app processes and adds to the backend database. The problem is for large files something seems to be timing out after around 2 or 3 minutes and a page entitled 404 Not Found nginx/0.7.6 is displayed. The URL does not change however - i.e., it remains as the URL to the file upload page of my app. The Nginx error log shows: 2011/09/08 13:28:05 [error] 1349#0: *303

Log rotation with Gunicorn

本小妞迷上赌 提交于 2019-12-06 19:25:42
问题 I searched through the net but didn't get the concrete answer or example of "how to use log rotation with Gunicorn?" . It would be great if someone provide an example. 回答1: Gunicorn's documentation says you can setup log rotation with logrotate (a linux command): Logs can be automatically rotated and compressed using logrotate. Doc link: http://docs.gunicorn.org/en/latest/install.html?highlight=logrotate#debian-gnu-linux So I guess Gunicorn provides itself no way to rotate log. Here is an

Nginx configuration for static sites in root directory, Flask apps in subdirectories

ぐ巨炮叔叔 提交于 2019-12-06 18:22:01
问题 I'd like to have a static site in my root public_html directory, then Flask apps in their own subdirectories (e.g. public_html/foo). The static root directory functions as expected. I have spent hours editing the nginx configuration to get the Flask apps working, but always end up back in the same place, namely that the following code always returns 'Bad Config' when I migrate to mysite/foo. I want it to return 'Hello World!' If I alter the nginx configuration so that the server root is in

Make a non-blocking request with requests when running Flask with Gunicorn and Gevent

纵饮孤独 提交于 2019-12-06 17:04:10
问题 My Flask application will receive a request, do some processing, and then make a request to a slow external endpoint that takes 5 seconds to respond. It looks like running Gunicorn with Gevent will allow it to handle many of these slow requests at the same time. How can I modify the example below so that the view is non-blocking? import requests @app.route('/do', methods = ['POST']) def do(): result = requests.get('slow api') return result.content gunicorn server:app -k gevent -w 4 回答1: If

Environment variables not being set after configuring Nginx and Gunicorn (Django app on Ubuntu machine)

我的未来我决定 提交于 2019-12-06 13:37:25
问题 I just set up Gunicorn with Nginx (reverse proxy) for a Django web app. The combo seems to be firing up correctly as per gunicorn.log . Note that I'm not using supervisor. But curiously, my environment variables (set in .profile ) aren't being picked up at all! printenv shows they exist. Some things I've tried are putting the environment variables in /etc/default/nginx and restarting nginx, in etc/environment , in .profile , in nginx.conf , in gunicorn.conf , etc. It just doesn't work! By the

First name, last name and email address leak in forms randomly

余生颓废 提交于 2019-12-06 12:31:26
问题 we have implemented django-allauth into our web app and we are facing random leaks. When a new user enters signup page, sometimes user sees first name, last name and email address of lastly logged user prefilled in signup form . This occurs really randomly, just sometimes. This also happens in profile edit form, which is just simple django form taking instance of user from self.request.user in CBV (FormView) like this: def get_form_kwargs(self): kwargs = super(ProfileView, self).get_form

搭建宜信漏洞管理平台-洞察系统

别说谁变了你拦得住时间么 提交于 2019-12-06 12:15:16
step1:安装mysql客户端,后面执行初始化,sql用 #yum install mariadb step2:安装git工具,后面拉取代码用 yum install git step3:docker安装mysql镜像 #docker pull mysql:5.7.13 step4:初始化数据库 step5:拉取镜像 # docker pull daocloud.io/liusheng/vulpm_docker:latest step6:启动洞察服务 # docker run -d -p 9000:5000 \ --link open_source_mysqldb:db \ --name open_source_srcpm \ -v $PWD/srcpm:/usr/local/src/insight/srcpm \ -e DEV_DATABASE_URL='mysql://vuluser:vulpassword@db/vuldb' \ -e SrcPM_CONFIG=development \ -e MAIL_PASSWORD='xxxxxx' \ daocloud.io/liusheng/vulpm_docker:latest \ sh -c 'supervisord -c /usr/local/src/insight/srcpm/supervisor.conf &&