swedishfished
swedishfished

Reputation: 399

Django: How to access STATIC_FILES that I set in settings.py in another view?

I keep getting the following error: name 'STATIC_DIRS' is not defined, when I try to access it in a view from my settings.py. What do I import to make this work in my views?

Upvotes: 0

Views: 40

Answers (1)

Pythonista
Pythonista

Reputation: 11635

You can import the following:

from django.conf import settings

And then you can access variables set in your settings file by doing settings.variable

Upvotes: 2

Related Questions