解决ImportError: Settings cannot be imported的问题

"ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined."

错误原因:无法导 入 Settings, DJANGO_SETTINGS_MODULE 环境变量没有定义。

解决如下 :

在/etc/profile文件末尾添加环境变量:

export PYTHONPATH=$PYTHONPATH:/data/djcode/mysite/mysite:/data/djcode/mysite

export DJANGO_SETTINGS_MODULE=mysite.settings

使环境变量生效 :source /etc/profile

问题解决。

时间: 2024-08-03 18:35:32

解决ImportError: Settings cannot be imported的问题的相关文章

python下使用protobuf

python解决ImportError: No module named google.protobuf 关于protocol buffer的优点,就过多涉及:如果涉及到数据传输和解析,使用pb会比自己去写解析代码更有效率,至少对于大部分而言是这样的. 一.下载,安装 到code.google.com下载源码,解压: ./configure && make && make check && make install 最后一步涉及到权限,可能会需要sudo.二

解决php的It is not safe to rely on the system’s timezone settings

  在写php程序中有时会出现这样的警告: PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are st

解决php的“It is not safe to rely on the system’s timezone settings”问题_php技巧

如果使用PHP5.3以上版本时,如果没有正确的配置php.ini就会出现PHP日期函数的错误.以前很多旧的PHP编程教程没有说到这个问题,所以不少读者会觉得困惑,下面笔者为大家讲述解决这个问题的三种方法."PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date. timezone setting

ImportError: No module named readline错误解决办法

python版本是2.7.5,系统为centos7.x系列 错误代码: [root@Shell site-packages]# python Python 2.7.5 (default, Mar 18 2016, 16:51:30) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2 Type "help", "copyright", "credits" or "license"

Win7打开C盘Documents and Settings文件夹提示没有权限的解决方法

解决方法如下: 1.右击Documents and Settings文件夹------属性: 5.选中Everyone或Administrators----------点击"编辑": 6.在完全控制的"允许"上打钩---------确定. 这样就可以正常打开Documents and Settings文件夹了. 上述教程内容就是小编为大家带来的关于Win7打开C盘Documents and Settings文件夹提示"没有权限"的问题方法了,比较

解决MySQLdb ImportError: libmysqlclient.so.18错误

安装MySQLdb后,import MySQLdb出错如下:  代码如下 复制代码 [root@lizhong MySQL-python-1.2.3]# /usr/local/bin/python2.7 Python 2.7.6 (default, Apr 10 2014, 15:45:39) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2 Type "help", "copyright", "credit

MySQLdb ImportError: libmysqlclient.so.18解决方法_python

安装MySQLdb后,import MySQLdb出错如下: 复制代码 代码如下: [root@lizhong MySQL-python-1.2.3]# /usr/local/bin/python2.7 Python 2.7.6 (default, Apr 10 2014, 15:45:39) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2 Type "help", "copyright", "credit

怎么解决win7系统中documents and settings目录无法访问

  1.首先鼠标右击"documents and settings"文件夹,在打开的属性界面中切换到"安全"选项卡下,点击"高级"按钮; 2.在打开的高级设置窗口中,切换到"所有者"选项卡下,这里所有者默认是"SYSTEM",这边将所有者更改为自己; 3.之后就能够修改权限了,因为"拒绝"的优先级高于"允许",所以必须删掉图中的那项,不然还是会导致无法访问的,很简单吧

centos提示ImportError: No module named MySQLdb解决办法

系统:centos 5.9  需要的软件包:setuptools-0.6c11.tar.gz                      MySQL-python-1.2.3.tar.gz                1.安装setuptools-0.6c11  代码如下 复制代码 wget --no-check-certificate  http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz ta