On Tue, Jul 12, 2016 at 02:36:41PM -0700, Malik Rumi wrote:
> Michal,
> 
> > , it looks like somewhere, you're calling ``os.path.join(a, b)``, where
> the second argument starts with a slash
> 
> I've tried it both ways. The way I got findstatic to work was by taking off
> the leading slash, but so far I haven't figured out how to make that work
> so that the files are called.

I'm afraid I still don't have enough information to help you – you
still haven't provided the other details I asked for in my previous
email, i.e. the URL of a failing request, and a full traceback. While
we're at it, showing how you are referencing static files in your
templates wouldn't hurt either.

In the meantime, just two observations.

> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
> 
> INSTALLED_APPS = (
>     'django.contrib.admin',
>     'django.contrib.auth',
>     'django.contrib.contenttypes',
>     'django.contrib.sessions',
>     'django.contrib.messages',
>     'django.contrib.staticfiles',
>     'essell',
>     'csvimport2',
>     'debug_toolbar',
>     'account',
> )
> 
> MIDDLEWARE_CLASSES = (
>     'django.contrib.sessions.middleware.SessionMiddleware',
>     'django.middleware.common.CommonMiddleware',
>     'django.middleware.csrf.CsrfViewMiddleware',
>     'django.contrib.auth.middleware.AuthenticationMiddleware',
>     'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>     'debug_toolbar.middleware.DebugToolbarMiddleware',
>     'django.contrib.messages.middleware.MessageMiddleware',
>     'django.middleware.clickjacking.XFrameOptionsMiddleware',
>     'django.middleware.security.SecurityMiddleware',
> )
> 
> STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
> STATIC_URL = '/static/'
> 
> # Extra places for collectstatic to find static files.
> STATICFILES_DIRS = [
>     os.path.join(BASE_DIR, 'static'),
>     os.path.join(BASE_DIR, 'static/bootstrap'),
>     os.path.join(BASE_DIR, 'static/bootstrap/css/'),
>     os.path.join(BASE_DIR, 'static/bootstrap/fonts/'),
>     os.path.join(BASE_DIR, 'static/bootstrap/js/'),
>     os.path.join(BASE_DIR, 'static/css/'),
>     os.path.join(BASE_DIR, 'static/email_templates/'),
>     os.path.join(BASE_DIR, 'static/fonts/'),
>     os.path.join(BASE_DIR, 'static/images/'),
>     os.path.join(BASE_DIR, 'static/js/'),
>     os.path.join(BASE_DIR, 'static/less/'),
>     os.path.join(BASE_DIR, 'static/plugins/'),
>     os.path.join(BASE_DIR, 'static/videos/'),
> ]

Do you have any specific reason to make those static files available
in two locations? As in, your videos will be available in both
/static/videos/some-video.wtf, and /static/some-video.wtf. Your
bootstrap assets will be available in three locations (/static/,
/static/bootstrap/, /static/bootstrap/whatever/). I fail to see how
that will lead to anything other than confusion and problems... You
might want to remove everything but the first element in this list,
and always use the full /static/somedir/another/somefile.ext paths to
reference static files.

> # Simplified static file serving.
> # https://warehouse.python.org/project/whitenoise/
> STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

Since you're using whitenoise, have you tried to follow the setup
instructions at http://whitenoise.evans.io/en/stable/django.html in
their entirety? I'm mostly referring to the middleware.

However, as even the whitenoise docs say, before you start playing
around with whitenoise, you should first make sure your basic
staticfiles setup is correct.

Cheers,

Michal

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20160714061917.GA16002%40koniiiik.org.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Digital signature

Reply via email to