Tag Info

Hot answers tagged

24

I prefer uwsgi because it's super configurable and has tons of options. From the benchmarks I've done it has the best performance/memory usage. It's very flexible and can probably be configured precisely to suit your needs. I use uwsgi's emperor mode to host multiple apps. It will scan a given directory for config files and launch/manage all applications it ...


9

I would suggest the use of supervisord. In my experience, it is friendlier and generally a smoother experience than runit or the venerable daemontools. Upstart is designed to replace the equally-venerable init process, while supervisord is specifically for managing things like WSGI, FastCGI, and the like. It is also pretty well-documented. Because it is ...


7

Add to nginx location: fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name;


6

Because nginx is an event driven system, it is in effect single threaded at lowest level. In other words, not much different to prefork MPM when using Apache. This means that once a request is being handled in the WSGI application running under nginx/mod_wsgi, no parallel tasks can be carried out. In prefork MPM of Apache this isn't too serious an issue ...


5

Take a look in /proc/<PID>/fd which should list all of the open files that PID has open. On my CentOS system fd 7 is lrwx------. 1 root root 64 Aug 28 22:01 7 -> socket:[1872522] I can then use netstat -ane | grep 1872522 to get tcp 0 0 :::443 :::* LISTEN 0 1872522 You can use lsof | grep ...


4

unable to find "application" callable in file /var/www/coefficient/flask.py is the key :) Your app is defining an 'app' callable, so you have to instruct uWSGI to search for it, instead of 'application'. You can use the option callable: app and it will works (this is explained in official Flask docs)


4

For newer versions of apache you might need this. <Directory /opt/graphite/conf> #Order deny,allow #Allow from all Options All AllowOverride All Require all granted </Directory>


4

Your mod_wsgi was compiled for Python 2.7. You cannot then try and point it at a Python 2.5 virtual environment. Also, the setting: WSGIPythonHome /home/rory/tix/virtualenv2.5/lib/python2.5/ is pointing at the wrong thing even if it was a Python 2.7 virtual environment. The settings: UnSetEnv PYTHONSTARTUP SetEnv PYTHONPATH ...


4

you would run your python server on a different port, then make use of Apache's (or any decent webserver like nginx etc) reverse proxy functionality to reverse proxy any requests for example/com/reallycoolpythonwebapp to the python app server this will also appear transparent to the user as well some apache config within the example.com vhost might look ...


3

I got it working! Here's what I did: Created /etc/uwsgi/apps-available/myapp.xml: <uwsgi> <socket>/tmp/uwsgi-myapp.sock</socket> <plugins>http, python</plugins> <chdir>/path/to/directory/containing/python/app</chdir> <module>myapp</module><!-- myapp.py from before --> ...


3

You are reading it wrong. Apache does start as 'root' and the parent Apache process stays as 'root', only the Apache server child process run as 'www-data'. The mod_wsgi daemon processes are forked from the parent 'root' process and so will still be able to change to that user. What the comment is saying is that if you start Apache from a totally non ...


3

Use method described in: http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive Thus have DocumentRoot setup as normal for static files and php files etc. Then add: AddHandler wsgi-script .wsgi to Directory block for DocumentRoot, or globally for server. You will though need to have: Options ExecCGI enabled for ...


3

You didn't asked for a specific version of ISPConfig so I'll assume you are using ISPConfig 3. I didn't tried that by myself, but I've found here a step-by-step instructions on how to install ispconfig3 + django + mod_wsgi - Django and mod_wsgi | HowToForge Forums If somethings goes wrong you could try reply to the mentioned thread or start a new thread ...


3

yum install mod_wsgi confirmed on CentOS 5.7


3

Use WSGIRestrictStdout option: WSGIRestrictStdout Off or replace sys.stdout with sys.stderr in Django WSGI star script: import sys sys.stdout = sys.stderr Writing To Standard Output No WSGI application component which claims to be portable should write to standard output. That is, an application should not use the Python print statement without ...


3

Looking at my little VPS, I can determine the fd number the following way: ll /proc/17684/fd/ |colrm 1 46 0 -> /dev/null 1 -> /dev/null 10 -> /var/www/vhosts/censored.xenuser.org/statistics/logs/error_log 11 -> /var/www/vhosts/censored.de/statistics/logs/error_log 12 -> /var/www/vhosts/censored.org/statistics/logs/error_log 13 -> ...


3

you have more config-options with a full-blown reverse - proxy like rewrite locations server https header-cleanup expires gzip .... you can do loadbalancing you can use proxy_cache you can implement custom error-pages, even when your app-servers are down you can have a WAF implemented you can (sometimes) hotpatch against vulnerabilities BONUSPOINT ...


3

It would be loaded once per process. You likely are using a multiprocess configuration and subsequent requests are being handled by different process and/or processes are being recycled. Print out the process ID in the debug. Also go read: http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading ...


2

Have you tried using New Relic to try and identify whether it is an issue in your web application? Free tier available and also a initial full trial. Overview of what it can give you in: http://lanyrd.com/2012/pycon/spcdg/ If a specific issue with web application of backend service that is used doesn't stand out as an issue, the WSGI server capacity ...


2

I fixed it. I converted all the production sites to use their own process (and all development sites all together in one process as well), in daemon mode. The Smokeping graphs are a lot better now. Performance is steady. This still leaves me in the dark about why embedded mode had these problems, because as far as I can tell I had no process ...


2

Network Performance Analysis: You're doing it wrong. Tracert and Ping ARE NOT network performance analysis tools. They are tools for tracing the route to a host and for testing basic connectivity to a host. The problem with using tracert as a network performance analysis tool lies in the fact that tracert sends ICMP packets TO each hop in the route. ...


2

the --app option is deprecated by more than a year (it should be reported in uWSGI logs if you use a stable version 1.2/1.4). For wsgi apps you use --module (for python modules) and --wsgi-file (for .wsgi files)


2

I was able to get around this issue by editing /proc/sys/net/core/somaxconn from 128 to 20000. This allows larger bursts of traffic. I may not have needed to set it so high, but this application can burst very high. I am also using gunicorn & nginx.


2

You MPM settings are a bit broken for various reasons for a start. Suggest you watch my talk from PyCon at: http://lanyrd.com/2013/pycon/scdyzk/#link-qhyk As to your server hanging, you likely have a third party extension module being used which isn't safe to use from a sub interpreter. You need to force your application to run in the main interpreter. ...


2

In general, it is better to use logging for any kind of debug output in a web app and never use print statements at all. Or use them in the form: print >> environ['wsgi.errors'], "message to be printed" It is best to get rid of sys.stdout by making it a copy of sys.stderr just in case. If you do development on a UNIX server, you can have two ...


2

in /etc/apache/apache2.conf, set LogLevel to warn or error http://httpd.apache.org/docs/current/mod/core.html#loglevel to control logging on a module level do this: LogLevel error mod_wsgi:warn (global log level to error, but show warnings from the wsgi module) I believe this ability was added in apache 2.4...


2

Shouldn't you have issued restart as an argument to your init script? I would expect sudo /etc/init.d/nginx start to complain if nginx was already running. Which it sounds like it was.


2

you can use a decorator on your views to make them only avail from ssl. @secure_required @login_required def edit_member(request, slug): ... http://www.redrobotstudios.com/blog/2009/02/18/securing-django-with-ssl/


2

It should go outside of any VirtualHost directives. See: http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPythonHome Per definitions at: http://httpd.apache.org/docs/2.2/mod/directive-dict.html#Context and linked from context label for the entry, the value 'server config' means: """This means that the directive may be used in the server ...


2

add --limit-as option to each instance and limit the number of requests each process will manage after being restarted (-R 1000 is normally a good value, this will mitigate leaks) 30 processes per app looks a bit too much for me, start with 8 (ncpu*2) and increase them if you need it If you want, you can use the development tree (take it via mercurial) and ...



Only top voted, non community-wiki answers of a minimum length are eligible