2011年1月3日 星期一

[Django] Deploy Django on Cherokee Web Server by uWSGI

Cherokee Web Server

The Fastest free Web Server out there!
Cherokee is a very fast, flexible and easy to configure Web Server. It supports the widespread technologies nowadays: FastCGI, SCGI, PHP, CGI, uWSGI, SSI, TLS and SSL encrypted connections, Virtual hosts, Authentication, on the fly encoding, Load Balancing, Apache compatible log files, Data Base Balancing, Reverse HTTP Proxy, Traffic Shaper, Video Streaming and much more.

Cherokee-Admin, a user friendly interface, provides a no-hassle configuration of the server. Check out the benchmarks and documentation to learn more, join our active Community and give it a try to squeeze your hardware to the fullest!




My Operating System is Ubuntu 10.10



Install Cherokee Web Server

sudo apt-add-repository ppa:cherokee-webserver/ppa
sudo apt-get update
sudo apt-get install cherokee
sudo apt-get install rrdtool
sudo apt-get install libcherokee-mod-rrd
sudo apt-get install libxml2
sudo pip install http://projects.unbit.it/downloads/uwsgi-latest.tar.gz
 


Setting Hosts (So that, you can visit your site on: http://test.example.org)

~$ vim /etc/hosts

127.0.0.1     test.example.org

Setting uWSGI (http://www.cherokee-project.com/doc/cookbook_uwsgi.html)

/var/www$ cat > django_wsgi.py
import os
import django.core.handlers.wsgi

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
application = django.core.handlers.wsgi.WSGIHandler()

/var/www$ cat > uwsgi.xml
<uwsgi>
    <pythonpath>/var/www/example/</pythonpath>
    <pythonpath>/var/www/</pythonpath>
    <app mountpoint="/">
        <script>django_wsgi</script>
    </app>
</uwsgi>




Create a Django Project

~$ django-admin startproject example
~$ cd example
~$ chmod a+rx manage.py


Starting with Chreokee Admin

~$ sudo chreokee-admin

Cherokee Web Server 1.0.15 (Dec 29 2010): Listening on port 127.0.0.1:9090, TLS
disabled, IPv6 enabled, using epoll, 4096 fds system limit, max. 2041
connections, caching I/O, 20 threads, 102 connections per thread, standard
scheduling policy

Login:
  User:              admin
  One-time Password: eXsuKzcGSKooQUZU

Web Interface:
  URL:               http://127.0.0.1:9090/


Keyin login into the form, then you can see:




Add a new virtual server

1. Click vServer Icon
2. Click Plus ( + ) to add new one
3. Choice uWSGI to be your platform
4. set uWSGI binary and Configuration file

uWSGI binary: /var/www/django_wsgi.py
Configuration file: /var/www/uwsgi.xml

5. Set new host name: test.example.org
6. Set Document Root: /var/www/example

Then open browser go to http://test.example.org, you will see it worked:



See Also
http://www.cherokee-project.com/doc/
Related Posts Plugin for WordPress, Blogger...