fabiogibson / django-livesync

Django App which automatically reloads your browser when Django Development Server restarts or static files and templates are modified.
GNU General Public License v3.0
27 stars 11 forks source link

Doesn't start with manage.py #11

Open ghost opened 4 years ago

ghost commented 4 years ago

I'm using Django 3 on Ubuntu. When I run python manage.py runserver after following the config instructions, I get the following error:

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/home/raphaelnazirullah/Documents/Mental Health Web app/mental_health_app/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/home/raphaelnazirullah/Documents/Mental Health Web app/mental_health_app/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/raphaelnazirullah/Documents/Mental Health Web app/mental_health_app/venv/lib/python3.6/site-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/raphaelnazirullah/Documents/Mental Health Web app/mental_health_app/venv/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 61, in execute
    super().execute(*args, **options)
  File "/home/raphaelnazirullah/Documents/Mental Health Web app/mental_health_app/venv/lib/python3.6/site-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/home/raphaelnazirullah/Documents/Mental Health Web app/mental_health_app/venv/lib/python3.6/site-packages/livesync/management/commands/runserver.py", line 110, in handle
    self.start_liveserver(**options)
  File "/home/raphaelnazirullah/Documents/Mental Health Web app/mental_health_app/venv/lib/python3.6/site-packages/livesync/management/commands/runserver.py", line 107, in start_liveserver
    self._start_watchdog()
  File "/home/raphaelnazirullah/Documents/Mental Health Web app/mental_health_app/venv/lib/python3.6/site-packages/livesync/management/commands/runserver.py", line 81, in _start_watchdog
    self.file_watcher.start()
  File "/home/raphaelnazirullah/Documents/Mental Health Web app/mental_health_app/venv/lib/python3.6/site-packages/livesync/fswatcher/watcher.py", line 18, in start
    self._schedule_all()
  File "/home/raphaelnazirullah/Documents/Mental Health Web app/mental_health_app/venv/lib/python3.6/site-packages/livesync/fswatcher/watcher.py", line 11, in _schedule_all
    for path in handler.watched_paths:
  File "/home/raphaelnazirullah/Documents/Mental Health Web app/mental_health_app/venv/lib/python3.6/site-packages/livesync/core/handler.py", line 22, in watched_paths
    os.path.join(d, 'templates') for d in get_app_template_dirs('')
  File "/home/raphaelnazirullah/Documents/Mental Health Web app/mental_health_app/venv/lib/python3.6/site-packages/livesync/core/handler.py", line 23, in <listcomp>
    if d.startswith(settings.BASE_DIR)
AttributeError: 'PosixPath' object has no attribute 'startswith'

My project structure is like this: . ├── db.sqlite3 ├── Dummy │   ├── admin.py │   ├── apps.py │   ├── forms.py │   ├── init.py │   ├── migrations │   ├── models.py │   ├── pycache │   ├── random.py │   ├── templates │   ├── tests.py │   ├── urls.py │   └── views.py ├── formsapp │   ├── admin.py │   ├── apps.py │   ├── experiments.py │   ├── forms.py │   ├── init.py │   ├── machine_learning.py │   ├── migrations │   ├── models.py │   ├── pycache │   ├── static │   ├── templates │   ├── templatetags │   ├── tests.py │   ├── urls.py │   └── views.py ├── manage.py ├── mental_health_app │   ├── asgi.py │   ├── init.py │   ├── pycache │   ├── settings.py │   ├── urls.py │   └── wsgi.py ├── my-cred.txt ├── pycache │   └── manage.cpython-36.pyc ├── README.md ├── requirements.txt ├── users │   ├── admin.py │   ├── apps.py │   ├── forms.py │   ├── init.py │   ├── migrations │   ├── models.py │   ├── pycache │   ├── templates │   ├── tests.py │   ├── urls.py │   └── views.py

AleksandrNem commented 3 years ago

I have the same error Python 3.8.5 Django==3.1.6

SKewLinez commented 3 years ago

Getting the same error here. Does anyone figure out a workaround yet?

Ymil commented 3 years ago

Hi folks, I made a pull request with the fix, it works on my computer (?)