At the moment I have
myproject/app1
And I am adding a second app in and I wish to share some common JS and CSS
I have moved my static files from
myproject/app1/static
to
myproject/static
What configuration changes do I have to make for the applications to recognize the new location? I don't remember ever setting the directory initially I think it just worked out of the box
From Django [1.11] Docs:
Your project will probably also have static assets that aren’t tied to a particular app. In addition to using a static/ directory inside your apps, you can define a list of directories (STATICFILES_DIRS) in your settings file where Django will also look for static files.
Add to settings.py:
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
Assuming you are using django.contrib.staticfiles app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With