我正在经历Django tutorial, 我能够执行以下步骤creating a project,database setup development server步骤中出现的问题。
我在虚拟环境中尝试了(venv)$ python manage.py runserver
输出:
Performing system checks...
System check identified no issues (0 silenced).
January 14, 2015 - 09:39:53
Django version 1.7.2, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[2015-01-14 09:39:54,347 pyinotify ERROR] add_watch: cannot watch /usr/local/lib/python2.7/dist-packages/django/contrib/auth/hashers.py WD=-1, Errno=No space left on device (ENOSPC)
[2015-01-14 09:39:54,348 pyinotify ERROR] add_watch: cannot watch /usr/local/lib/python2.7/dist-packages/django/test/__init__.py WD=-1, Errno=No space left on device (ENOSPC)
要检查我的分区磁盘是否空间不足,我尝试了
(venv) $ df
输出:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 236182272 56881792 167280052 26% /
none 4 0 4 0% /sys/fs/cgroup
udev 1969912 4 1969908 1% /dev
tmpfs 397084 1480 395604 1% /run
none 5120 0 5120 0% /run/lock
none 1985416 3048 1982368 1% /run/shm
none 102400 28 102372 1% /run/user
我可以清楚地看到可用部分中的空闲空间很少。
在尝试在Django中运行服务器之前,有没有人遇到此错误。
答案 0 :(得分:29)
您可能已达到手表配额。
要查找当前限制,请在终端中输入以下内容:
sudo sysctl fs.inotify.max_user_watches=16384
默认情况下通常为8192。
要增加限额,请输入:
echo 16384 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
然后重启django。
要永久设置此限制,请输入:
var spawn = require('child_process').spawn
spawn('open', ['http://www.stackoverflow.com']);
有一个非常详细的答案,您可以在此处找到更多信息:https://unix.stackexchange.com/a/13757/79648
答案 1 :(得分:1)
您可以尝试this链接。
基本上对我有用的是我使用了前3个命令:
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get autoremove
然后我重新启动了我的开发服务器,我没有看到错误。
答案 2 :(得分:0)
我试过
$virtualenv-3.4 -p /usr/bin/python3.4 venv
Running virtualenv with interpreter /usr/bin/python3.4
Using base prefix '/usr'
New python executable in venv/bin/python3.4
Also creating executable in venv/bin/python
Installing setuptools, pip...done.
workingdirectory
$ source venv/bin/activate
我再次安装了Django。
(venv)$ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
January 15, 2015 - 18:56:44
Django version 1.7.2, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
非常整洁,没有PyNotify错误