python - 未知命令 : 'clearsessions'

标签 python django django-admin

我使用的是 Django 1.5.1,根据 Django 文档,此 Django 版本已弃用清理,应使用清理 session 。 当我尝试使用 cleansessions 时,它显示未知命令。当我输入 djando-admin.py help 时。我没有在命令中列出它,而是列出了清理。 在使用 django-admin.py cleanup 时,出现以下错误 -

ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

不知道是什么原因造成的。

最佳答案

您应该始终使用 manage.py 而不是 django-admin.py 来运行任何依赖于现有项目的命令,因为它会为您设置 DJANGO_SETTINGS_MODULE。

关于python - 未知命令 : 'clearsessions' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20946366/

相关文章:

python - Django 模型表单集 : only track changes to those items that have been updated/saved in the set?

python - 我正在编写一个程序,从单词列表中查找字谜词,并按字母顺序在不同的列表中输出字谜词

python - 使用 Django 将数据发布到另一个站点

django - 如何访问表单类中的 session 变量

python - 避免在 Django admin 上显示模型数据的多个查询

python - concurrent.futures.ProcessPoolExecutor() python 中的共享变量

python - django-多语言和模板端语言之间的切换

django - 对于当前上下文而言,量化结果的位数过多

Django Admin 链接到相关对象

Python 3.7 : Unable to install gmpy2 in a venv in Windows 10