Structures the Django nosql application (a) based on mongodb, django-nonrel, NGinx, Green Unicorn

I would like to build the project need to use the mongodb based application framework Django under nosql. Its online based on django modify realize its for mongodb the types of data query for mongodb the engine., Delete, new, original django procedures to adapt for the the mongodb the operating code changes are relatively small, or very easy to start, do not write so much for mongdb specific query sql directly through raw_query similar to the original query.

The following instructions for the software:

The Django-nonrel: the Django 1.3 version support nosql data, is in fact the Django, just the author for revision, probably more than 100 lines of code for the nosqlthe djangotoolbox: some commonly used for nosql Django class, including some onetomany relations field, etc.

pymongo: the most basic implementation of python library for mongodb

Django the MongoDB Engine: for mongodb django on the engine. Directly in settings.py configured to use, very convenient, provided also with a lot. It relies on more than three class libraries.

The following compared to the installation steps (system environment ubuntu11.0):

1, first install the program the pip python similar to apt-get.

 sudo apt-get install python-pip

2, using virtualenv to install the python virtual environment, so to avoid the mess under our Python class library, but also to facilitate future maintenance and management.

 sudo pip  install  virtualenv 

3, start the virtual environment, so that the python-based operation in the virtual environment inside.


virtualenv - no-site-packages django_app

cd django_app

the source the bin / activate

4, install hg and git, if you do not install this follow-up to the installation prompts to install the program failed, could not obtain from github or other version of the server program.

5, the installation of Django the-nonrel, use pip to install from the Internet. Local file upload installed in a virtual environment also need to install python, and the other to be careful not free to use sudo, and may lead to other unexpected problems.

 pip install hg + https://bitbucket.org/wkornewald/django-nonrel 

6, installation djangotoolbox pip install with the above.


pip install hg + https://bitbucket.org/wkornewald/djangotoolbox

7, install gcc and to python-dev. Why be installed with reference to Article 8.

8, install the Django the MongoDB Engine. With the above pip to install, just install the address on the git. In addition, when installing the mongodb engine. Will be installed dependent pymongo, never installed gcc and to python-dev, compile errors that prevented if can not find the gcc, or can not find python.h error. Therefore, it is strongly recommend that you install gcc and python-dev.

 pip install git + https://github.com/django-nonrel/mongodb-engine 

9, Green, of Unicorn is installed. Green, of Unicorn as a python the WSGI server than the original CGI and FastCGI, the mod_python much faster. With nginx is a good a choice.

 pip install django gunicorn 

10 After installation, create the django project, and then the unicorn run to test whether the installation was successful.


django-admin.py startproject the app
the cd the app
gunicorn_django-b 0.0.0.0:8000

At this point the django nosql should be set up almost the mongodb and nginx to continue to build tomorrow.

本文固定链接: http://www.higis.org/en/2012/04/24/django-nosql-with-nginx-mongodb/ | Hi,GIS


该日志由 H.J 于2012年04月24日发表在 WebServer 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: Structures the Django nosql application (a) based on mongodb, django-nonrel, NGinx, Green Unicorn | Hi,GIS
关键字: , , , ,

Structures the Django nosql application (a) based on mongodb, django-nonrel, NGinx, Green Unicorn:等您坐沙发呢!

发表评论

快捷键:Ctrl+Enter