Django同步数据库

问题描述:使用Django部署web应用时,同步数据库遇到问题

[root@localhost ChickenRun]# ./manage.py syncdb
NameError: name 'amdin' is not defined
直接去python的解释器中,检测django.contrib.admin

Python 2.6.6 (r266:84292, Sep 11 2012, 08:28:27)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from django.contrib import admin
>>> ......
django.core.exceptions.ImproperlyConfigured: Requested setting DATABASES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or ca

........

环境工具:Win7(32bit)  VMware9.0 centOS6.3 Django1.5.1 Python2.6.6

解决过程:export DJANGO_SETTINGS_MODULE=ChickenRun.settings

ChickenRun.settings.py在虚拟机的路径为/usr/bin/ChickenRun/ChickenRun/settings.py

其中ChickenRun是用django-admin.py startproject ChickenRun创建的项目

猜你喜欢

转载自834945712.iteye.com/blog/1859761