Django:manage.py runserver失败,出现watchman异常

问题描述

当我尝试在一个全新的项目上运行manage.py runserver时,出现了一个监视器异常:

(towngen) gru-mbp:towngenweb gru$ ./manage.py runserver
Watching for file changes with WatchmanReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin,auth,contenttypes,sessions.
Run 'python manage.py migrate' to apply them.
September 01,2020 - 01:07:15
Django version 3.1,using settings 'towngenweb.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
  File "./manage.py",line 22,in <module>
    main()
  File "./manage.py",line 18,in main
    execute_from_command_line(sys.argv)
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/core/management/__init__.py",line 401,in execute_from_command_line
    utility.execute()
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/core/management/__init__.py",line 395,in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/core/management/base.py",line 330,in run_from_argv
    self.execute(*args,**cmd_options)
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/core/management/commands/runserver.py",line 61,in execute
    super().execute(*args,**options)
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/core/management/base.py",line 371,in execute
    output = self.handle(*args,**options)
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/core/management/commands/runserver.py",line 96,in handle
    self.run(**options)
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/core/management/commands/runserver.py",line 103,in run
    autoreload.run_with_reloader(self.inner_run,**options)
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/utils/autoreload.py",line 613,in run_with_reloader
    start_django(reloader,main_func,*args,**kwargs)
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/utils/autoreload.py",line 598,in start_django
    reloader.run(django_main_thread)
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/utils/autoreload.py",line 313,in run
    self.run_loop()
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/utils/autoreload.py",line 319,in run_loop
    next(ticker)
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/utils/autoreload.py",line 532,in tick
    self.update_watches()
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/utils/autoreload.py",line 505,in update_watches
    self._update_watches()
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/utils/autoreload.py",line 494,in _update_watches
    self._watch_root(root)
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/django/utils/autoreload.py",line 421,in _watch_root
    result = self.client.query('watch-project',str(root.absolute()))
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/pywatchman/__init__.py",line 1052,in query
    res = self.receive()
  File "/Users/gru/.venvs/towngen/lib/python3.8/site-packages/pywatchman/__init__.py",line 962,in receive
    raise CommandError(result['error'])
pywatchman.CommandError: watchman command error: Failed to validate command: resolve_projpath:  None of the files listed in global config root_files are present in path `/Users/gru/.venvs/towngen/lib/python3.8` or any of its parent directories.  root_files is defined by the `/etc/watchman.json` config file and includes `.watchmanconfig`.  One or more of these files must be present in order to allow a watch. Try pulling and checking out a newer version of the project?,while executing ('watch-project','/Users/gru/.venvs/towngen/lib/python3.8')

我的目录结构如下:

(towngen) gru-mbp:towngen gru$ ls -la
total 104
drwxr-xr-x  14 gru  1876110778    448 Aug 31 18:07 .
drwxr-xr-x   4 gru  1876110778    128 Aug 28 18:31 ..
drwxr-xr-x  15 gru  1876110778    480 Aug 31 18:08 .git
-rw-r--r--   1 gru  1876110778     41 Aug 28 18:32 .gitignore
drwxr-xr-x   8 gru  1876110778    256 Aug 31 17:58 .idea
-rw-r--r--   1 gru  1876110778    232 Aug 30 21:54 .pre-commit-config.yaml
drwxr-xr-x   9 gru  1876110778    288 Aug 28 18:57 .pyre
-rw-r--r--   1 gru  1876110778    238 Aug 28 18:56 .pyre_configuration
-rw-r--r--   1 gru  1876110778      3 Aug 28 18:56 .watchmanconfig
drwxr-xr-x   4 gru  1876110778    128 Aug 30 22:03 __pycache__
-rw-r--r--   1 gru  1876110778    452 Aug 31 17:54 requirements.txt
-rw-r--r--   1 gru  1876110778   4176 Aug 31 17:13 tests.py
-rw-r--r--   1 gru  1876110778  22459 Aug 31 17:13 towngen.py
drwxr-xr-x   5 gru  1876110778    160 Aug 31 18:05 towngenweb
(towngen) gru-mbp:towngen gru$ ls -la towngenweb/
total 8
drwxr-xr-x   5 gru  1876110778  160 Aug 31 18:05 .
drwxr-xr-x  14 gru  1876110778  448 Aug 31 18:07 ..
-rw-r--r--   1 gru  1876110778    0 Aug 31 18:05 db.sqlite3
-rwxr-xr-x   1 gru  1876110778  666 Aug 31 18:04 manage.py
drwxr-xr-x   9 gru  1876110778  288 Aug 31 18:05 towngenweb
(towngen) gru-mbp:towngen gru$ ls -la towngenweb/towngenweb/
total 32
drwxr-xr-x  9 gru  1876110778   288 Aug 31 18:05 .
drwxr-xr-x  5 gru  1876110778   160 Aug 31 18:05 ..
-rw-r--r--  1 gru  1876110778     0 Aug 31 18:04 __init__.py
drwxr-xr-x  6 gru  1876110778   192 Aug 31 18:05 __pycache__
-rw-r--r--  1 gru  1876110778   397 Aug 31 18:04 asgi.py
-rw-r--r--  1 gru  1876110778  3083 Aug 31 18:04 settings.py
lrwxr-xr-x  1 gru  1876110778    16 Aug 31 18:04 towngen.py -> ../../towngen.py
-rw-r--r--  1 gru  1876110778   752 Aug 31 18:04 urls.py
-rw-r--r--  1 gru  1876110778   397 Aug 31 18:04 wsgi.py

我的.watchmanconfig为空:

(towngen) gru-mbp:towngen gru$ cat .watchmanconfig
{}

我做错了什么或想念什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...