一.创建工程
1.进入django/bin目录下
cd /usr/share/pyshare/django/bin
2.python django-admin.py startproject myproject
用find查看: find / -depth -name "myproject"
/usr/share/pyshared/django/bin/myproject
myproject目录结构,
myproject/ __init__.py manage.py settings.py urls.py |
按照不同情况设定不同的参数,修改settings.py文件
3。运行
python manage.py runserver 8080
提示:
Django version 1.3.1, using settings 'myproject.settings'
Development server is running at http://127.0.0.1:8080/
Quit the server with CONTROL-C.
此时用其他机器访问不了,加上ip地址即可
python manage.py runserver 192.168.240.102:8080
提示:
Validating models...
0 errors found
Django version 1.3.1, using settings 'myproject.settings'
Development server is running at http://192.168.240.102:8080/
Quit the server with CONTROL-C.
二.django在apache2下运行
find / -name "*python*.so"
/usr/lib/python2.7/config/libpython2.7.so
/usr/lib/libpyglib-gi-2.0-python2.7.so
http://archive.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz