Search code examples
pythondjangodjango-settings

Django server not reloading on file changes


I just cloned a Django project from my Github for maintenance on another machine, installed all the dependencies then ran the server. Everything seems to be working fine except the fact that the server does not reload when I make file changes (on all python files). Changes in static files are not reflected too. Things to note:

  • Django 4.0.3
  • Python 3.9.0
  • Environment manager is Pipenv.

Settings.py

DEBUG = True

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, "templates")],

I don't have a custom runserver command
I have the suggestions on this question but they didn't work.

Any help would be greatly appreciated.


Solution

  • To reload all static files in the browser you need to press ctrl + f5 (refreshes cache)

    Also, make sure to run the python manage.py collectstatic command to save all static files in a single directory or even use compressed storage.

    For all python files, make sure that autosave is enabled on Visual Studio Code (I have faced this issue too)