gunicorn

Flask on Heroku: request.form is incredibly slow with large POST data?

穿精又带淫゛_ 提交于 2019-12-09 13:05:05
问题 I'm running a Flask app on Heroku using gunicorn with eventlet workers. A particular route on my app frequently receives POST data (x-www-form-urlencoded) with some fairly chunky fields -- on the order of 500KB at most. This works fine when running locally, but on Heroku, requests to that route takes anywhere from 5 to 30 seconds to complete -- and almost 100% of the time is spent in the first access to request.form: t = time.time() action = str(request.form['action']) dt = time.time() - t #

Static Files not being displayed in Production

心不动则不痛 提交于 2019-12-08 21:44:46
EDITED TO SHOW UPDATED CONFIGURATION No static files are being shown in Production. Files are showing correctly in Development settings.py BASE_DIR = os.path.dirname(__file__) STATIC_ROOT = '/opt/soundshelter/static/' print "Base Dir: " + BASE_DIR #this returns /opt/soundshelter/soundshelter/soundshelter print "Static Root: " + STATIC_ROOT #this returns /opt/soundshelter/static/ STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), ) #/opt/soundshelter/soundshelter/soundshelter/static Files are being called in the applications with <link href="{% static "css/portfolio

Is supervisord needed for docker+gunicorn+nginx?

丶灬走出姿态 提交于 2019-12-08 19:16:37
问题 I'm running django with gunicorn inside docker, my entry point for docker is: CMD ["gunicorn", "myapp.wsgi"] Assuming there is already a process that run the docker when the system starts and restart the docker container when it stops, do I even need to use supervisord? if gunicorn will crash won't it crash the docker and then restart? 回答1: The only time you need something like supervisord (or other process supervisor) in a Docker container is if you need to start up multiple independent

Procfile gunicorn custom module name

爱⌒轻易说出口 提交于 2019-12-08 18:01:15
问题 Context: I am writing a medium sized flask application (10-15 views), and in the process, I am hoping to organize the code in a manner that will make it easily maintainable and extensible (not a monolithic file as most Flask applications are). The structure of the application mimics the documentation as follows: /AwesomeHackings /ENV /AwesomeHackings /models /static /templates /__init__.py /awesome.py /awesome.cfg /Procfile /README.MD /requirements.txt /run.py Problem: I am unable to get

SQLAlchemy extension isn't registered when running app with Gunicorn

吃可爱长大的小学妹 提交于 2019-12-08 17:20:50
问题 I have an application that works in development, but when I try to run it with Gunicorn it gives an error that the "sqlalchemy extension was not registered". From what I've read it seems that I need to call app.app_context() somewhere, but I'm not sure where. How do I fix this error? # run in development, works python server.py # try to run with gunicorn, fails gunicorn --bind localhost:8000 server:app AssertionError: The sqlalchemy extension was not registered to the current application.

ModuleNotFoundError - No module named 'main' when attempting to start service

一笑奈何 提交于 2019-12-08 16:49:13
问题 Context: I created a Django application using Python 3.7. I am (attempting) to use the 2nd generation Google App Engine standard environment. My application performs flawlessly when I run it via python manage.py runserver . Yet it comes to a sudden halt when I attempt to deploy it to Google App Engine. Traceback (most recent call last): File "/tmp/tmphgUsp3/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker worker.init_process() File "/tmp/tmphgUsp3/lib/python3.7/site

How to run my Django application automatically on production server [closed]

喜欢而已 提交于 2019-12-08 14:10:55
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . I built an application on my local machine with Python and Django. Its working fine. Now, I would like to automate the process to start my Django application on a production server. What I have to do to achieve that? 回答1: Django documentation don't recommend to use Django built-in server on

How can I make nginx/gunicorn use structured logging?

旧城冷巷雨未停 提交于 2019-12-08 13:16:42
问题 I currently see 172.19.0.1 - - [09/Feb/2018:07:00:32 +0000] "GET /ping HTTP/1.1" 200 1 "-" "curl/7.47.0" within my logs, but I use structured logging like this. I even tried ch = logging.StreamHandler() ch.setFormatter(pythonjsonlogger.jsonlogger.JsonFormatter()) logging.getLogger("urllib3").addHandler(ch) but I still see those messages. I have nginx/gunicorn like this (source): nginx = subprocess.Popen(['nginx', '-c', '/opt/program/nginx.conf']) gunicorn = subprocess.Popen(['gunicorn', '-

django+gunicorn+nginx wierdness

余生颓废 提交于 2019-12-08 12:37:20
问题 I am following the instructions in http://senko.net/en/django-nginx-gunicorn/ to deploy my django application. My application is running under gunicorn and I have configured nginx to serve the site. Everything is fine except that the static files are looked inside a 'static' subdirectory of the actual static file directory. I have the following stanza for static files in the nginx configuration file: location /static { root /webapps/myproject/project_staticfiles; } where /webapps/myproject

gunicorn Connection in use for python flask

青春壹個敷衍的年華 提交于 2019-12-08 11:22:34
问题 I recently changed my Heroku Python Flask app from the ' small application ' format to the 'simple package' format based from flask documentation (De-coupling everything in app.py into separate subdirectories) The application runs correctly using > python runserver.py However, executing gunicorn runserver:app --log-file=- outputs: "Starting gunicorn .... connection in use error" (loops forever) My runserver.py configuration is: from re3 import app app.run(debug=True) __init__.py configuration