2010年08月29日 星期日 20:59
 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
 
 
2010年08月29日 星期日 22:02
There's a problem:
 
 The server can't find "/media", so there's none css and image found.
the interface of admin looks terrible, how was that?
the settings.py :
ADMIN_MEDIA_PREFIX = '/usr/local/lib/python2.6/site-packages/django/contrib/admin/media/'
and the Nginx server default.conf:
        
 
  
   location /media {
   
                   root /usr/lib/python2.5/site-packages/django/contrib/admin/media;
  
 
}
2010年08月30日 星期一 09:20
为什么不用apache 我的apache安装好了 没这么复杂呢。。
2010年08月30日 星期一 09:22
没什么,熟悉一下nginx。
2010年08月30日 星期一 09:26
另外可能引起问题就是Django的版本不同造成的。办公室是django1.0.4的,家里windows是1.1的,家里ubuntu是1.2.1的。对Ubuntu也不熟悉,晕得很。
2010年08月30日 星期一 09:27
你该花时间 学下LINUX 了·~
2010年08月30日 星期一 09:37
呵呵。没有专门的时间,边用边学吧。
Zeuux © 2025
京ICP备05028076号