今天要在Django+gae上開發一些東西

就去官網上看一下發現到

Debian-
A packaged version of Django is available for Debian GNU/Linux. Version 0.95.1 is available in the “stable” repository; Version 0.96 is available in the “testing” and “unstable” repositories. Regardless of your chosen repository, you can install Django by typing apt-get install python-django.
When you install this package, apt will recommend installing a database adapter; you should select and install the adapter for whichever database you plan to use with Django.

Ubuntu-
The Debian python-django package is also available for Ubuntu Linux, in the “universe” repository for Ubuntu 7.10 (“Gutsy Gibbon”). The current Ubuntu package is based on Django 0.96.1 and can be installed in the same fashion as for Debian.

1. 想當然的我們就可以輕輕鬆鬆的

aptitude install python-django

2. 創立django用的目錄

django-admin startproject project

裡頭會有這些東西:__init__.py  __init__.pyc  manage.py  settings.py  settings.pyc  urls.py

3.啟動server

python manage.py runserver

4. 在firefox看看,小試一下吧!http://127.0.0.1:8000/

 

5. 可是這樣只接受local端,對外完全沒辦法 ,所以這時需要搭配apache囉!因為我是設在自己的public_html裡的project目錄

    我就在[huki@htc-huki /etc/apache2]$ sudo vi sites-available/default加入

    <Directory /home/huki/public_html>
        SetHandler python-program
        PythonPath "['/home/huki/public_html'] + sys.path"
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE djangotest.settings
        PythonDebug On
    </Directory>

6. 重啟apache

sudo /etc/init.d/apache restart

接下來就好好開發吧!

另外,若有人知怎麼讓所有使用者public_html都可以變成default的django的目錄可以教一下嗎?!

若有發開的一些心得我也會再放上來的

arrow
arrow
    全站熱搜

    huki 發表在 痞客邦 留言(0) 人氣()