On Mon, Mar 10, 2014 at 1:02 AM, Vernon Burt <charger...@gmail.com> wrote:
> I suppose that's my confusion - before this, each application directory had
> it's own /static/ directory with /css/, /js/ and /img/ directories as
> needed. I adjusted the settings as mentioned and tried the following:

Yes - that is how it should be, apart from for project static files,
if you have any of those. You do not move the static files out of the
applications.

>
> DEBUG = False
> PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
> STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
> STATIC_URL = '/static/'
> STATICFILES_DIRS = ( os.path.join(PROJECT_PATH, 'static'),)

So, a slight problem here. STATIC_ROOT and STATICFILES_DIRS should be different.

STATICFILES_DIRS is a list of _additional_ directories that are copied
to STATIC_ROOT when you run collectstatic. This is where you list your
project static file directories, if you have any. You do not _need_ to
have any project static files, if all your static files are in
my_app/static, then you do not need to put anything in
STATICFILES_DIRS.

STATIC_ROOT is where files are collected to, IE it should be an empty
folder, it should not be the origin of your static files, it is where
your static files are copied to so that they can be efficiently
delivered to your users.

>
>
> CollectStatic now works properly - it collects everything into the project
> root under static. File linking isn't though - the links dont work, and so
> none of the css or javascript loads. I'm wondering if I'm misusing the css
> tags I'm testing with. An example from my base template:
>
> {% load static %}
>     <link href="{% static '/css/custom.css' %}" media="screen">
>
> Thank you for your time,
>

Have you configured apache or nginx (or whatever you use) to serve the
directory STATIC_ROOT at the url STATIC_URL?

Cheers

Tom

-- 
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/CAFHbX1K%3DvjiBTnjynfnnUu3LpPWubW886%3Ds7WijatEP0UwKGYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to