Python论坛  - 讨论区

标题:[python-chinese] 在Media Temple(dv)上安装使用Django

2007年10月10日 星期三 22:40

Nickcheng nick.maillist在gmail.com
星期三 十月 10 22:40:29 HKT 2007

Ô­Îļû:
http://nickcheng.com/2007/10/10/install-and-setup-django-on-media-temple-dvd/

Ñ¡Ôñ MT , ³ýÁËËûÄÇЩ֪ÃûµÄ¿Í»§Èº, »¹¿´ÉÏÁËËû VPS ϵͳµÄ¸ß¿ÉÅäÖÃÐÔ. ¶ÀÁ¢µÄÐé»ú¿ÉÒÔÈÃÄãÔÚÉÏÃæ°²×°ÈκÎÄãÐèÒªµÄ¶«Î÷, µ±È»,
ÄãÒ²Òª¶®µÃÔõôȥ²Ù×÷.

×Ô¼ºµÄ Django ÏîÄ¿ÒѾ­ÓÐЩ³ûÐÎÁË, ËùÒÔÒ²Òª¿¼ÂÇÈÃËûÄÜÔÚ MT ÉÏÔËÐÐÁË. ËäȻǰ¶Îʱ¼ä MT ¶ÔËûµÄ (gs) ·þÎñÌṩÁË Django
µÄÖ§³Ö, µ«ÊÇ (dv) ·þÎñ»¹ÊÇûÓйٷ½µÄ Django Ö§³Ö, ËùÒÔÎÒÖ»ÄÜ×Ô¼º¶¯ÊÖÀ´°²×°ÅäÖÃÁË!

¾­¹ýÒ»·¬ÃþË÷ºÍ³¢ÊÔ, ÒÔ¼° Richard ͬѧ(ÕâλͬѧÊÇÎÒÔÚ Django µÄ maillist ÉÏÕÒµ½µÄ¿ÉÒÔɧÈŵÄÈË^_^)µÄ°ïÖú,
ÎÒÖÕÓÚÔÚ×Ô¼ºµÄÕ¾µãÉÏ¿´µ½ÁË"Worked"µÄ×ÖÑù. ×Ô¼ºÔÚÍøÉÏËÑË÷Ïà¹Ø×ÊÁϵÄʱºòһֱûÓп´µ½ÓÐÈËдÔÚ MT ÉÏ°²×° Django µÄ¾­Ñé,
ÄÇôÎÒ¾Í×÷ΪµÚÒ»¸ö³Ôó¦Ð·µÄÈË°É, Ï£Íû´ó¼ÒÔÚËÑË÷"mt django"¹Ø¼ü×ÖµÄʱºòÄÜËѵ½ÎÒµÄÎÄÕÂ:) (ÊÇ·ñÐèÒªÔÙдһƪӢÎĵÄ?)

ºÃ°É, ÎÒÃÇ¿ªÊ¼¸É»îÁË! ´ó¼ÒÔÚÄ£·ÂµÄʱºòÇë×¢ÒâÐÞ¸ÄÄã×Ô¼ºµÄÓòÃûºÍ×ÓÓòÃû.

   - ÔÚ×Ô¼ºµÄÓòÃûϽ¨Á¢Ò»¸ö×ÓÓòÃû, ·½±ãÎÒÃǸɻî. ÎÒÔÚÎÒµÄ nickcheng.com ÓòÃûϽ¨Á¢ÁËÒ»¸ö
   lab.nickcheng.com ×ÓÓòÃû. Õâ¸ö¹¤×÷ÔÚ plesk ϾͿÉÒԸ㶨.
   - È¡µÃ MT µÄ Shell ȨÏÞ, ²¢ÇÒ»ñµÃ×Ô¼ºµÄ root ÃÜÂë, ÒòΪÎÒÃÇÐèÒª±È½Ï¸ßµÄȨÏÞÀ´×öÕâЩÊÂÇé. root ÃÜÂëÐèÒªÔÚ MT
   ÖÐÌá½»Ò»¸ö Support À´»ñÈ¡.
   - ½øÈë Shell ģʽ, Çл»µ½ root ȨÏÞ(ʹÓà su ÃüÁî)
   - Çл»µ½×ÓÓòÃû lab ËùÔÚµÄĿ¼, ²¢½¨Á¢ Django Ŀ¼, ÏÂÔØ/½âѹËõ Django

   cd /var/www/vhosts/nickcheng.com/subdomains/lab
   mkdir django
   cd django
   wget http://www.djangoproject.com/download/0.96/tarball/
   tar xzvf Django-0.96.tar.gz


   - °²×° Django

   cd /var/www/vhosts/nickcheng.com/subdomains/lab/Django-0.96
   python setup.py install

ÉÏÃæµÄ²½ÖèÈç¹ûû´íµÄ»°, Django ¾ÍÒѾ­ÔÚÄãµÄ·þÎñÆ÷ÉÏ°²×°ºÃÁË. ΪÁËÑéÖ¤Ò»ÏÂ, ÎÒÃÇ¿ÉÒÔʹÓÃÈçϵIJ½Öè.

python
import django

Èç¹ûûÓб¨´í, ÄÇô¾ÍÖ¤Ã÷ÎÒÃǵÄÒѾ­³É¹¦°²×°ÁË Django. ½ÓÏÂÀ´ÊÇÅäÖà Django Õ¾µãÁË.

   - Ê×ÏȲ»½¨Òé°ÑÄãµÄ Django ÍøÕ¾µÄÔ´´úÂë·ÅÔÚ httpdocs Ŀ¼ÏÂ, ÒòΪÕâÑùÈç¹û²Ù×÷²»µ±, »áÓпÉÄܸø±ðÈËÏÂÔØÄãÔ´ÂëµÄ»ú»á,
   ËùÒÔÎÒ»¹ÊÇ°Ñ Django ÍøÕ¾µÄÔ´´úÂë·ÅÔÚÁË֮ǰ½¨Á¢µÄ django Ŀ¼ÖÐ.

   cd /var/www/vhosts/nickcheng.com/subdomains/lab/django
   django-admin.py startproject djangotest
   - ½¨Á¢ÁË djangotest Õâ¸ö django ÍøÕ¾ºó, ¾ÍÊÇ×îÖØÒªµÄÅäÖò½ÖèÁË. ÎÒÃÇÏÈÇл»µ½ÅäÖÃÎļþËùÔÚµÄĿ¼

   cd /var/www/vhosts/nickcheng.com/subdomains/lab/conf
   - ÕâʱÕâ¸öĿ¼Ӧ¸ÃÊÇ¿ÕµÄ, ÎÒÃÇÐèÒª×Ô¼º½¨Á¢ÅäÖÃÎļþ. ÒòΪ MT ×Ô´øÁË vi, ËùÒÔÎÒÓÃËüÀ´×öÕâ¸öÊÂÇé

   vi vhost.conf
   - ¹ØÓÚ vi µÄ²Ù×÷»¹Çë´ó¼Ò×Ô¼ºÑ§Ï°. ÎÒÌùÒ»ÏÂÎÒµÄ vhost.conf ÎļþµÄÄÚÈÝ

   
   SetHandler python-program
   PythonPath "['/var/www/vhosts/nickcheng.com/subdomains/lab/django/'] +
   sys.path"
   PythonHandler django.core.handlers.modpython
   SetEnv DJANGO_SETTINGS_MODULE djangotest.settings
   PythonDebug On
   

   - µÚÒ»ÐÐ, Location ºóµÄ·¾¶²»ÊÇÖ¸´ÅÅÌÉϵÄ·¾¶, ¶øÊÇÓû§·ÃÎÊÍøÕ¾µÄ·¾¶. ÎÒÕâÀïÓà "/" ÊÇÖ¸Óû§·ÃÎÊ
      http://lab.nickcheng.comʱµÄÅäÖÃ.
      - µÚ¶þÐÐ, Ö¸Ã÷Õâ¸ö·¾¶ÏÂʹÓõÄHandler, ÕâÀïʹÓÃpython
      - µÚÈýÐÐ, Ö¸Ã÷ÄãµÄ Django ÍøÕ¾Ô´ÂëËùÔڵķ¾¶. ÐèҪעÒâµÄÊÇ, ÕâÀïµÄ·¾¶ÒªÐ´ÄãÖ´ÐÐ django-admin.pyÎļþʱËùÔÚµÄĿ¼.
      - µÚÎåÐÐ, ҪдÍêÕûÄ㽨Á¢µÄ project µÄ settings.
   - ÅäÖÃÍê³Éºó, ÎÒÃÇÐèÒªÖØÆô·þÎñÀ´ÈÃËûÉúЧ.
   /usr/local/psa/admin/sbin/websrvmng -a -v

ÏÖÔÚ·ÃÎÊ http://lab.nickcheng.com, Ó¦¸Ã¿ÉÒÔ¿´µ½ "It worked!" µÄ×ÖÑùÁË:) ÎÒÃdzɹ¦ÁË
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071010/da34921f/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号