Hi Gary,

> ├── archive
> │   ├── archive
> │   │   ├── __init__.py
> │   │   ├── settings.py
> │   │   ├── urls.py
> │   │   └── wsgi.py
> │   ├── home
> │   │   ├── __init__.py
> │   │   ├── static
> │   │   │   ├── home.css
> │   ├── manage.py

In your first example, "home" is an app (not a project) that has some static 
files. "archive" is your project. 

Your "home" app doesn't follow the recommended filesystem structure, though. 
You should do this:

archive/
  home/
    __init__.py
    static/
      home/
        home.css

Note that there is no need to have an __init__.py file in any of your static 
dirs.

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.

-- 
René Fleschenberg

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/1569211.VEHN1toeuZ%40rex.
For more options, visit https://groups.google.com/d/optout.

Reply via email to