2008年11月28日 星期五

Debugging django with PyScripter

Debugging django with PyScripter

Here is how you can debug Django applications with Pyscripter in six simple steps:
  1. In the File explorer locate the root directory of your Django application. You may want to right click on the directory name and select File Explorer, Explore here.
  2. Open the project files in Pyscripter (e.g., models,py, views.py etc.) and set whatever breakpoints you want.
  3. Select Run, Command Line Parameters... and set the command line to "runserver --noreload". Also check the "Use Command line" checkbox.
  4. Make sure the remote engine is selected (Run, Python Engine, Remote).
  5. Open the manage.py file and press the debug button (or press F9).
  6. Start a web browser and test your application. Pyscripter should now stop at whatever breakpoints you have set and you can use the various debugging facilities (call stack, variables, interpreter prompt etc.)

To stop debugging, right-click on the interpreter window and select "Reinitialize Interpreter", then go to the browser and reload the document.

Django 學習筆記(1)

如何安裝: 現在version Django-1.0.2-Final
1.Django Homepage and Download
Homepage => http://www.djangoproject.com/
Download =>http://www.djangoproject.com/download/

2.解壓縮方法: window 就用 7-zip 解,然後放到你的 Python中
把Django\"Django" 放到 如:C:\Python25\Lib\site-packages\django

3.把 django-admin.py copy 到 "C:\Python25\Scripts"
django-admin.py 應該在"C:\Python25\Lib\site-packages\django\bin"

4.把 c:\python25\scripts 加到環境變數中
[window版] 控制台-->系統-->進階 -->環境變數 -->path

5.如何產生網站:django-admin.py startproject mysite
看一下目錄 c:\mysite

6.mysite 內容:
mysite/
__init__.py

manage.py

settings.py
urls.py

7.開起web server -> 到 c:\mysite 打 python mange.py runserver ,
然後 http://127.0.0.1:8000/
要換port 就用 ==> python mange.py runserver
8080

8.Edit
c:\mysite\settings.py
  • DATABASE_ENGINE = 'sqlite3'
  • DATABASE_NAME = r'c:\mysite\django.db'
7. 先把admin 裝起來 Edit c:\mysite\settings.py ,找一下INSTALLED_APPS
加入 'django.contrib.admin',
'mysite.blog',
改成中文/台灣地區
TIME_ZONE = 'Asia/Taipei'
LANGUAGE_CODE = 'zh-tw'

8. python manage.py syncdb 產生DB table

2008年11月21日 星期五

動物農莊

當一個團體以服從為最高原則,當命令來自人,團體將變成那就是那個人的工具
所有法律也將沒有效果,一切只是虛幻,只有那個人說了才算!
這就是我們的處境呀!

自由尊重是這麼的薄弱,當恐懼佔據人心,我將指使你,你終將成為我的奴隸,
你是害怕這個恐懼,看不透恐懼,還是害怕他的權力 ?
這就是我們的處境呀!