1. uWSGI Installation. $ sudo pip-3.6 install uwsgi Collecting uwsgi Downloading uwsgi-2.0.17.tar.gz (798kB) 100% |################################| 798kB 709kB/s Installing collected packages: uwsgi Running setup.py install for uwsgi ... done Successfully installed uwsgi-2.0.17 1.1 Basic test Let’s start with a simple “Hello World” example: def application(env, start_response): start_response('200 OK', [('Content-Type','text/html')]) return [b"Hello World"] As you can see, it is composed of a single Python function. It is called “application” as this is the default function that the uWSGI Python loader will search for (but you can obviously customize it). 1.2 Now start uWSGI to run an HTTP server/router passing requests to your WSGI application: uwsgi --http :9090 --wsgi-file foobar.py 2.Installing Django. Install Django into your virtualenv , create a new project $ mkproject django $ pip install Django Collecting Django ...
In httpd.conf file make sure the "cgi" LoadModule directive has not been commented out. A correctly configured directive may look like this: <IfModule mpm_prefork_module> LoadModule cgi_module libexec/apache24/mod_cgi.so </IfModule> Explicitly using Options to permit CGI execution To allow CGI program execution for any file ending in .cgi in users' directories, you can use the following configuration. <VirtualHost *:80> DocumentRoot "/usr/local/www/apache24/e" ServerName www.example.com ErrorLog "/var/log/e-error_log" CustomLog "/var/log/e-access_log" common <Directory "/usr/local/www/apache24/e/"> Order allow,deny Allow from all Require all granted Options +ExecCGI AddHandler cgi-script .cgi </Directory> </VirtualHost> <Directory "/home/*/public_html"> Options +ExecCGI AddHandler cgi-script .cgi </Di...
Comments
Post a Comment