[Answer]-Double path – Django collectstatic

0👍

You probably need an initial slash in your STATICFILES_DIRS values:

if DEBUG:
    STATICFILES_DIRS = (
        # Put strings here, like "/home/html/static" or "C:/www/django/static".
        # Always use forward slashes, even on Windows.
        # Don't forget to use absolute paths, not relative paths.
        '/home/projects/Klanestro/static',
        )
else:
    STATICFILES_DIRS = ('/root/Klanestro/static',)

(Note I really don’t recommend running under root in production. Create a relevant user, or use Apache’s existing user.)

1👍

Can you try adding a comma to the first place where you define your TEMPLATE_DIRS?

Like so:

TEMPLATE_DIRS = ('/home/talisman/projects/Klanestro/templates',)

This might have something to do with the fact that you’re not defining your TEMPLATE_DIRS the first time as a tuple (because of the missing comma).

If the first occurrence of TEMPLATE_DIRS is a tuple, django will concatenate (using +), other declarations of if, so you’ll get a tuple with two entries.

If, on the other hand, you first define it as a string (missing comma), the concatenation results in a string, of the original TEMPLATE_DIRS value with the string representation of the tuple you define the second time.

Leave a comment