繁体   English   中英

Django Shell不起作用?

[英]Django shell doesn't work?

当我启动django shell时,出现此内存错误! 我在没有root特权的共享主机上。 我无法安装Ipython,但我需要外壳。

$ python manage.py shell
Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_manager(settings)
  File "/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/django/core/management/base.py", line 218, in execute
    output = self.handle(*args, **options)
  File "/django/core/management/base.py", line 347, in handle
    return self.handle_noargs(**options)
  File "/django/core/management/commands/shell.py", line 26, in handle_noargs
    import IPython
  File "/usr/lib64/python2.7/site-packages/IPython/__init__.py", line 58, in <module>
    __import__(name,glob,loc,[])
  File "/usr/lib64/python2.7/site-packages/IPython/Shell.py", line 30, in <module>
    import ctypes
  File "/usr/lib64/python2.7/ctypes/__init__.py", line 555, in <module>
    _reset_cache()
  File "/usr/lib64/python2.7/ctypes/__init__.py", line 279, in _reset_cache
    CFUNCTYPE(c_int)(lambda: None)
MemoryError

您可以使用--plain选项。

也许这个答案可以帮助您: Python / Django shell无法启动

请检查/ tmp目录上的设置。 是否也设置了粘性位? 如果执行ls -ltrd / tmp,它应该类似于以下内容

# ls -ltrd /tmp drwxrwxrwt 6 root root 4096 Feb 5 16:43 /tmp

如果专门安装了/ tmp,也可以尝试重新安装(需要root用户才能执行此操作)。 我的/ tmp目录出问题了,因此我将其卸载并重新创建了/ tmp的新版本。 然后,以上错误对于我的应用程序消失了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM