Skip to main content

Posts

Showing posts with the label uWSGI

Django 1.7 + Nginx 1.4.6 + uWSGI 2.0.7 deployment

There are many ways to deploy Django project. Nginx and uWSGI is one of them. Nginx deals with static files. uWSGI transfers no-static file request from Nginx to Django. Note that you can only use uWSGI + Django for deployment. I assume you already installed Django, Nginx and uWSGI. (1) Test uWSGI. Write a simple test.py first # test.py def application ( env , start_response ) : start_response ( ' 200 OK ' , [( ' Content - Type ',' text / html ' )]) return "Hello World" Then run command uwsgi -- http : 8001 -- wsgi - file test . py Then you can check if   http://127.0.0.1:8001 is working (2) Test Django run command python manage.py runserver 0.0.0.0:8002 Then you can check if it is working. (3) Write Django uwsgi file write Django_wsgi.py file which is at the same directory with manage.py in Django project #!/usr/bin/env python # coding: utf-8 import os import sys reload(sys) sys.setdefaultenco...

pip install uwsgi error

Install uwsgi error by pip The error message is as follows Cleaning up ... Command / usr / bin / python - c "import setuptools, tokenize;__file__='/tmp/pip_build_root/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" You have to install python dev package sudo apt-get install python2.7-dev