半尾

半尾的博客

他的个人主页  他的博客

半尾ubuntu下配置Nginx+Django+flup+MySQL

半尾  2010年08月29日 星期日 20:56 | 4848次浏览 | 0条评论

一直以来都想在自己感兴趣的ubuntu下配置上Django的开发学习环境,一方面用来学习ubuntu基础的linux,一方面学习python的web框架django,当然离不开熟悉的MySQL数据库。从网上找了个方面的资料,终于完成了。
当然里面具体的一些配置涵义我是不理解的,只是能用了

1.ubuntu版本 windows xp下安装的wubi ubuntu10.04lts
2.python:系统自带python2.6.5
3.安装django
   网上下载django 1.2.1版本。
   相应目录下 sudo python setup.py install
4.安装nginx
  sudo apt-get install nginx
 安装后nginx到设置文件在/etc/nginx/nginx.conf
 它的server设置在/etc/nginx/sites-available/default.conf
 修改default.conf需要修改该文件的权限:
配置default.conf
server中添加:
location / {
                fastcgi_pass 127.0.0.1:8000;
                fastcgi_param PATH_INFO $fastcgi_script_name;
                fastcgi_param REQUEST_METHOD $request_method;
                fastcgi_param QUERY_STRING $query_string;
                fastcgi_param CONTENT_TYPE $content_type;
                fastcgi_param CONTENT_LENGTH $content_length;
                fastcgi_pass_header Authorization;
                fastcgi_param REMOTE_ADDR           $remote_addr;
                fastcgi_param SERVER_PROTOCOL       $server_protocol;
                fastcgi_param SERVER_PORT           $server_port;
                fastcgi_param SERVER_NAME           $server_name;
                fastcgi_intercept_errors off;
        }
5.安装python-flup
   可以在ubuntu软件中心下安装或者sudo apt-get install python-flup

最后用fcgi的形式运行项目:
python manage.py runfcgi host=127.0.0.1 port=8000

这里会看到运行结果。“It's worked。“

6.安装mysql。 在ubuntu软件中心下找到mysql server 5.1安装。
7.安装python-mysql ,同上。 可以在python里import MySQLdb试试。
>>> import MySQLdb
>>> conn = MySQLdb.Connection('localhost','root','123456','')
>>> conn
<_mysql.connection open to 'localhost' at 92fd30c>
>>> conn.close()
>>> conn
<_mysql.connection closed at 92fd30c>
8.安装mysql的管理工具,直接利用了ubuntu里到MySQL管理员。

参考内容:
http://hi.baidu.com/10428/blog/item/7b0301f403c559e77709d776.html
http://lloydsheng.com/2010/06/how-install-django-flup-nginx-in-unbuntu.html
http://blog.stevenwang.name/ngnix-django-175001.html
http://andexiazi.blogcn.com/diary,25287160.shtml
http://blog.robotercoding.com/?p=59
http://blog.wgzhao.com/2010/05/20/deploy-django-with-nginx.html
http://hi.baidu.com/ghiewa/blog/item/c9fabbfb19de2f2a4f4aeab6.html
http://lloydsheng.com/2010/05/how-to-install-django12-and-mysql-python-in-linux.html
http://hi.baidu.com/10428/blog/item/2c772a7ff637060c28388ada.html
http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/
http://wenku.baidu.com/view/4573663f5727a5e9856a613a.html
http://www.linuxidc.com/Linux/2010-04/25522.htm
http://database.51cto.com/art/201005/202479.htm
http://www.ourubuntu.com/config/2009/1111/ubuntu-mysql-install.html
http://crucial-systems.com/installing-mysqldb-ubuntu-mysql-python

评论

我的评论:

发表评论

请 登录 后发表评论。还没有在Zeuux哲思注册吗?现在 注册 !

暂时没有评论

Zeuux © 2024

京ICP备05028076号