gunicorn

Flask app running with gunicorn and nginx is crashing at redirecting point

不羁岁月 提交于 2019-12-11 04:28:03
问题 Can you please help? I am stuck. My server is crashing at @return redirect(url_for(‘login’)) ,when I run it using gunicorn i.e. $gunicorn — bind 127.0.0.1:5000 -w 4 wsgi:app. Same issue arises when I run it using supervisor. The code is working fine when I run it normally i.e. python app.py Appreciate any suggestions. 回答1: Try using this config, might help you. Create a new file in /etc/nginx/sites-enabled/ server { listen 80 ; server_name abc.com; large_client_header_buffers 8 32k; if ($http

Performance degradation for Django with Gunicorn deployed into Heroku

£可爱£侵袭症+ 提交于 2019-12-11 03:58:35
问题 I am playing with Heroku to test how good it is for Django apps. I created a simple project with two actions: return simple hello world generate image and send it as response I used siege -c10 -t30s to test both Django dev server and gunicorn (both running on Heroku). These are my results: Simple hello world - django dev Lifting the server siege... done. Transactions: 376 hits Availability: 100.00 % Elapsed time: 29.75 secs Data transferred: 0.00 MB Response time: 0.29 secs Transaction rate:

gunicorn is corrupting sys.path

ぐ巨炮叔叔 提交于 2019-12-11 03:09:26
问题 I wrote a simple python program: # /tmp/src/Code.py import sys print sys.path # /tmp/src/Main.py import Code When I run it with python src/Main.py , it works as expected: max% cd /tmp max% setenv PYTHONPATH src max% python src/Main.py ['/tmp/src', '/tmp/src', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages',

Django File Upload with nginx / gunicorn - media permissions

前提是你 提交于 2019-12-11 03:08:43
问题 I'm trying to allow users of my django site to upload a file (mostly PDFs) to my server through a FileField on a model. However, I keep running into 'Errno 13 Permission Denied' when trying to use the upload field generated by my modelform. I have found many potential solutions while searching around, but haven't been able to get anything to work properly so far. This is my first real deployment and I have probably confused myself. For reference, I am on Ubuntu 14.04, Django 1.6, & gunicorn

Do I need call monkey.patch_all() in Django+Gunicorn+GEvent+Boto structure?

我怕爱的太早我们不能终老 提交于 2019-12-11 02:36:35
问题 My website is using Django+Gunicorn+GEvent. There is a function which I have to use Boto for DynamoDB. Do I need call monkey.patch_all() to make Boto become greenlet? 回答1: If you use the default worker_class configuration, then you don't have the features of gevent. Look the doc here. I think you don't have the advantage of using gevent when you use the default configuration even though you monkey patch all. So you should configure gunicorn to use the GeventWorker which does the monkey.patch

How to change request_uri in nginx proxy_pass?

≯℡__Kan透↙ 提交于 2019-12-11 02:22:09
问题 I am running a django application through gunicorn via unix socket and I have my nginx configuration which looks like this : Current NGINX config File : upstream django_app_server { server unix:/django/run/gunicorn.sock fail_timeout=0; } server{ listen 80; server_name demo.mysite.com; location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; if (!-f $request_filename) { proxy_pass http://django_app_server; break; } } } so

Gunicorn+Django+Heroku. Python Path Issue

与世无争的帅哥 提交于 2019-12-11 02:16:52
问题 I'm running a Django app that I used to deploy to Heroku with Gunicorn without a hitch. By that I mean that I could run foreman start on my localhost and be able to understand whether the application would work in the production environment. I recently made the decision to move all of our project's applications into a subfolder named 'applications'. This meant editing my DJANGO_SETTINGS_MODULE environment variable among other files. After doing this, I experimented with foreman and gunicorn

Gunicorn Nginx Permission denied while connecting to upstream

吃可爱长大的小学妹 提交于 2019-12-11 01:46:44
问题 Setting up a django site with gunicorn & nginx gunicorn settings for projects : [Unit] Description=gunicorn daemon After=network.target [Service] User=username Group=nginx WorkingDirectory=/home/username/my_project ExecStart=/home/username/my_project/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/username/my_project/my_project.sock my_project.wsgi:application [Install] WantedBy=multi-user.target Nginx configuration file for project: user nginx; server { listen 80; server_name

How can I run long tasks on Google App Engine, which uses gunicorn?

。_饼干妹妹 提交于 2019-12-11 01:03:03
问题 GAE flex uses gunicorn as an entrypoint by default which is fine, except I have a function that takes a very long time to process (scraping websites and story data in a db) and gunicorn times out at 30 seconds by default, then a new worker starts all over on the task, and so on and so forth. I can set the gunicorn timeout to something like 20 minutes, but it doesn't seem graceful. Is there any way to run these backend functions "outside" of gunicorn, or perhaps a gunicorn config I'm not

https://example.com/admin redirects to https://admin in Django Nginx and gunicorn

筅森魡賤 提交于 2019-12-11 00:11:38
问题 The entire application works with Django + Nginx + Gunicorn using SSL(in production). But when I try to access django-admin page by https://example.com/admin and try to login it redirects me to (https://admin). PS: Sorry for a silly question. Any inputs ? 回答1: This sounds very similar to Django's HttpResponseRedirect seems to strip off my subdomain. And if so, the likely issue is that either your nginx proxy or Gunicorn is not delivering the domain name (HTTP_HOST) to Django. Verify by