我正在尝试运行这个python模块
from settings import PROJECT_ROOT
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME' : os.path.join(BASE_DIR, 'db_name.sqlite3'),
}
}
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'sdfgtardyure34654356435'
# Python dotted path to the WSGI application used by Django's runserver; added in v1.4
WSGI_APPLICATION = 'wsgi.application'
############### PYSEC specific variables
# assumes this directory exists
DATA_DIR = "%s/pysec/data/" % PROJECT_ROOT
但是每当我试图通过F5
运行它时,我就会得到这个
Traceback (most recent call last):
File "C:\Python27\pysec-master\local_settings-example.py", line 11, in <module>
'NAME' : os.path.join(BASE_DIR, 'db_name.sqlite3'),
NameError: name 'os' is not defined
模块位于C:\Python27\pysec-master
中,我得到了here的pysec
你知道我要做什么才能成功地运行这个模块吗?
只需添加:
开始时,在:
这将导入python的模块os,这显然在稍后的模块代码中使用,而不会被导入。
问题是你忘了导入操作系统。添加这行代码:
一切都会好起来的。 希望这有帮助!
相关问题 更多 >
编程相关推荐