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 ...


8

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>


7

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)


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 ...


6

yum install mod_wsgi confirmed on CentOS 5.7


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

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

Both Pyramid and Nginx have very good documentation, independently. I assume you've built your site locally with Waitress or Paster serving the content. Essentially, from within Nginx's config, you are just going to direct incoming traffic from port 80 (the usual port for website traffic) to your Paster/Waitress port (e.g. 8000, 6543, etc.). There are some ...


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

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

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.


3

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)


3

ScriptAlias is for cgi-script handler in Apache. WSGIScriptAlias is equivalent for wsgi-script. If you want to mix them in the same directory, don't use either, use Alias, Options ExecCGI, AddHandler directives instead. See: http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive


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 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

Presuming you are not using a very old obsolete mod_wsgi version, you can say: WSGIDaemonProcess prod-instance WSGIScriptAlias /prod-instance /opt/wsgi_applications/prod/app.wsgi process-group=prod-instance application-group=%{GLOBAL} WSGIDaemonProcess test-instance WSGIScriptAlias /test-instance /opt/wsgi_applications/test/app.wsgi ...


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

The configuration you use really depends on the specifics of your particular Python web application. Without proper monitoring it will be very hard for you to optimally tune your Apache and mod_wsgi configuration. In just what you have explained so far I can see various potential issues. The first is that you are aiming to use mod_wsgi daemon mode, but are ...


2

Your Bottle server is either not running, or listening on a port other than 8080.


2

You cannot use /tmp to store sockets for interprocess communication in this scenario, because Apache uses private /tmp directories, a security feature that ensures that a process can only see its own /tmp directory; it cannot see what other processes write into /tmp because those other processes are actually writing into different directories. This means ...


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

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. ...



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