<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Sealyu

    --- 博客已遷移至: http://www.sealyu.com/blog

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      618 隨筆 :: 87 文章 :: 225 評論 :: 0 Trackbacks

    With Django 0.95 being introduced being introduced a few days ago, I figured a quick post on what we experienced installing Django might help someone out. None of this covers new ground, but perhaps another telling of the story will provide someone an extra hook to grab onto.

    This tutorial is going to cover installing Django with the following:

    • Apache 2
    • MySQL
    • mod_python
    • Python (2.4)

    For the record, I'm running all of this off of OpenSuSE 10.1 - so obligatory YMMV. Please comment with suggestions or problems if so, though.

    First off, make sure you've got Apache up and running. ps aux | grep httpd can tell ya for the most part. If you don't know how to do this much, though, I'm afraid you're reading the wrong tutorial.

    Step 1: Install mod_python

    This will vary pretty widely amongst distributions, but our goal was to have a package manager do it. One of the below will probably work for you:

    • SuSE: In YaST, search for mod_python in Software Management
    • Ubuntu/Debian/apt-based: apt-get install libapache2-mod-python2.4
    • Redhat/FC4: yum install mod_python

    Step 2: Install Django

    So with mod_python installed, now we can get to Django. We have been tracking along with Subversion up until now, but since we're getting ready to put a large (for us) site into production, we are planning on sticking with numbered releases, but it remains to be seen if we'll change our minds on that one in order to take advantage of the enhancements that continue to stream in. If you want to live closer to the edge, you can get the development trunk through subversion.

    # Most recent version at this point in time is 0.95
    wget http://www.djangoproject.com/download/0.95/tarball/
    tar -xzvf Django-0.95.tar.gz
    cd Django-0.95
    python setup.py install

    Note that the last command will automatically download and install 'setuptools' if you don't already have it installed.

    Step 3: Create a Project

    So assuming everything went well, (It did, didn't it?), we're ready to start our first django project. Start your first project by going into the directory you want to hold your django projects (preferably outside of your web document root), and typing:

    django-admin.py startproject myProject

    As the djangoproject.com tutorial says…

    django-admin.py should be on your system path if you installed Django via python setup.py. If it's not on your path, you can find it in site-packages/django/bin, where site-packages is a directory within your Python installation. Consider symlinking to django-admin.py from some place on your path, such as /usr/local/bin.

    This will start you off with the basic settings and files needed for your django project. But we're not done quite yet! We have to tell apache what to do to handle mod_python requests.

    Step 4: Configure Apache

    To get apache to handle python requests, we first need to activate mod_python. Again, this is one of those things that will vary pretty widely through distributions, but essentially you'll need this command in Apache's httpd.conf file:

    LoadModule python_module modules/mod_python.so

    (note: Purportedly on debian this is done for you automatically - so you will likely be able to skip this step)
    In OpenSuSE the best way to do this is to go into YaST-> Sysconfig Editor-> Network-> WWW-> Apache2, and append 'python' onto the APACHE_MODULES setting. There may be other ways to do this more painlessly than file editing in other distro's, as well. Let me know if there are and I will update this section.

    Now that apache knows about python, we have to tell it where to -use- python. So go into your httpd.conf file (if you're using virtual hosts, pick the appropriate virtual host config file) and add this location directive:

    <location "/myProject">
         SetHandler python-program
         PythonHandler django.core.handlers.modpython
         SetEnv DJANGO_SETTINGS_MODULE myProject.settings
         PythonPath "['/path/to/your/django/projects'] + sys.path"
         PythonDebug On
         PythonInterpreter myProject
     </location>

    Now save, restart apache, and browse to your server + /myProject (i.e., http://www.yourhost.com/myProject).

    Did it come up with a special looking 404 error? If so, you've got Django installed, man! Better go follow the more informative and better written Django Tutorial to see how to really get rolling with it - you're ready to start developing!

    posted on 2008-11-06 22:13 seal 閱讀(1378) 評論(0)  編輯  收藏 所屬分類: Python
    主站蜘蛛池模板: 男人都懂www深夜免费网站| 国产免费网站看v片在线| 999久久久免费精品国产| 亚洲国产成人片在线观看| 久久九九免费高清视频| 国产亚洲精品成人AA片新蒲金| 一级毛片在播放免费| 亚洲精品无码99在线观看| 一级毛片aa高清免费观看| 亚洲AV中文无码乱人伦在线视色| 日韩a毛片免费观看| 国产乱辈通伦影片在线播放亚洲| 久久精品无码免费不卡| 亚洲av无码一区二区乱子伦as| 久久国产精品免费专区| 亚洲午夜电影在线观看| 免费观看的毛片手机视频| 国产精品亚洲一区二区三区| 亚洲成aⅴ人片久青草影院| 国产精品综合专区中文字幕免费播放 | 国产亚洲视频在线观看| 久久青青草原亚洲av无码| 爱丫爱丫影院在线观看免费| 日韩亚洲Av人人夜夜澡人人爽| 国产成人免费午夜在线观看| 久久精品熟女亚洲av麻豆| 亚洲人妻av伦理| 久久国产精品国产自线拍免费| 亚洲欧洲春色校园另类小说| 真实乱视频国产免费观看| 一区二区三区在线免费观看视频| 亚洲成人激情在线| 噼里啪啦电影在线观看免费高清| 色www免费视频| 亚洲av成人无码久久精品 | 日本黄页网站免费| 欧洲人成在线免费| 亚洲精品无码久久久久YW| 亚洲V无码一区二区三区四区观看 亚洲αv久久久噜噜噜噜噜 | 免费A级毛片无码A∨男男| 97人妻精品全国免费视频|