如何独立使用django的数据库访问功能
1个回答
展开全部
1. 安装Django
[plain] view plain copy
cd Django-1.4
python setup.py install
2. 安装postgresql的客户端:
[plain] view plain copy
sudo apt-get install -y postgresql-client-9.1 python-psycopg2
3. 新建project:
[plain] view plain copy
django-admin.py startproject myproject
4. 在myproject下新建app:
[plain] view plain copy
python manage.py startapp myapp
4. 新增环境变量:
编辑/etc/profile文件,在末尾加入以下语句:
[plain] view plain copy
<span style="color:#FF0000;"> export PYTHONPATH=$PYTHONPATH:/home/yc/src/myproject
export DJANGO_SETTINGS_MODULE=myproject.settings</span>
[plain] view plain copy
cd Django-1.4
python setup.py install
2. 安装postgresql的客户端:
[plain] view plain copy
sudo apt-get install -y postgresql-client-9.1 python-psycopg2
3. 新建project:
[plain] view plain copy
django-admin.py startproject myproject
4. 在myproject下新建app:
[plain] view plain copy
python manage.py startapp myapp
4. 新增环境变量:
编辑/etc/profile文件,在末尾加入以下语句:
[plain] view plain copy
<span style="color:#FF0000;"> export PYTHONPATH=$PYTHONPATH:/home/yc/src/myproject
export DJANGO_SETTINGS_MODULE=myproject.settings</span>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询