Search code examples
djangodjango-staticfilesmezzanine

Mezzanine Static files not serving from STATIC_ROOT


I am new to Mezzanine and not an expert in Django. I am trying to make changes in the default Mezzanine theme. I am doing these steps to override default Mezzanine theme,

python manage.py collectstatic

A new static folder is created which stores all the static files across the project in this folder (STATIC_ROOT). This includes Mezzanine default static files as well from virtualenv/lib/python2.7/site-packages/mezzanine/core/static/

Then I run

python manage.py collecttemplates

A new templates folder is created which stores all the templates across the project in this folder.

Now when I make changes in files from /templates directory I get to see those changes in development server.

but when I make changes in /static directory files I do not see those changes in development server.

to make changes to css files I have to go to virtualenv/lib/python2.7/site-packages/mezzanine/core/static/ path and then only I can see the changes in development server.

I want to know what am I doing wrong. I do not want to make changes in mezzanine css files, I want to overwrite them form static_root.


Solution

  • In mezzanine and in django sites in general, you should not edit files in the /static folder directly since these will be overwritten each time you use the collectstatic command.

    Each of the templates Mezzanine provides can be found in the templates directory of each Django app that Mezzanine is comprised of. E.g the base template in mezzanine/core/templates/base.html.

    To edit the templates you’d like to modify, copy them into your project’s templates directory and modify them there. You can also use the collecttemplates command to copy templates over automatically. Run python manage.py collecttemplates --help for more info.

    The mezzanine template lookup system is described here. This post may also be useful