Hi Gary,

You can certainly setup a global static files location. All you need to do
is add a path to STATICFILES_DIRS in your settings file. However, that is
not really necessary. All files that are in a static directory in one app
are accessible in other apps. You can create an app that contains css and
js files needed for the other apps and concentrate them in one app. The
only thing you need to think about is if you want to make sure that the
apps are completely unconnected.

Regards,

Andréas

2015-11-08 16:43 GMT+01:00 Gary Roach <gary719_li...@verizon.net>:

> On 11/07/2015 04:29 PM, René Fleschenberg wrote:
>
>> Hi Gary,
>>
>> In your second example:
>>
>>> ├── archive
>>> │   ├── archive
>>> │   │   ├── __init__.py
>>> │   │   ├── settings.py
>>> │   │   ├── urls.py
>>> │   │   └── wsgi.py
>>> │   ├── home
>>> │   ├── static
>>> |   |     |___home
>>> │   │         ├── home.css
>>> │   │         ├── images
>>>
>> you have what I would call a "global" static files directory. Files from
>> this directory will only be found if you configure that directory in your
>> settings:
>>
>> STATICFILES_DIRS = (
>>      os.path.join(BASE_DIR, "static"),
>> )
>>
>> This is because that directory is not part of any app that is listed in
>> INSTALLED_APPS.
>>
>> BASE_DIR is the top-level "archive" directory, by the way (the first
>> "archive" in the tree).
>>
>> I hope this helps.
>>
>>
>> Because this gets asked so often, I am trying to  to sump it up here:
>>
>> https://fleschenberg.net/django-staticfiles/
>>
>> I'd love to hear your feedback about this article, i.e. if it clarifies
>> things for you, or how to improve it.
>>
>> Thanks for the tips. I read your 'In a nutshell" . Good work. Now,
> getting into setup philosophy, it occurs to me that it would be nice to
> have  global static files for such things as a style.css file since the
> file should set the style of your whole web site. I suppose that one could
> put a copy of the file under each apps static folder but change control
> would be horrible. Could I set up both a global static folder and then have
> a static folder under each app? Being rather new to this rats nest (great
> framework all the same) I'm probably skating on rather thin ice here. Be
> kind.
>
> As to your comment on the first tree, I think I created the problem while
> cutting and pasting. The actual project works - mostly.
>
> A comment on "6 An alternative approach". This actually my case. When you
> say that the app listed first takes precedence.
>
> Looking forward to your comments.
>
> Gary R
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/563F6DA5.1050909%40verizon.net
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUb%3D3N%3D4ZRVv9ChR4PJDAOEy2aXMm%2B4ERt%3DWMEUasnbaYig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to