correct static files setting
Question: Hello I'm very confused about setting static files up. Every thing works
fine(displays image, javascript, css) no matter what I try. So I'm confused
which one is the right one.

Currently, this is how my project looks like

    
    
    project
    --project
    ---------static
    ---------media
    --env
    --static
    --------media
    --------static
    

And this is my code

    
    
    MEDIA_URL = '/media/'
    MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static", "media")
    
    STATIC_URL = '/static/'
    STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)
    STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static", "static")
    # List of finder classes that know how to find static files in
    # various locations.
    STATICFILES_FINDERS = (
        'django.contrib.staticfiles.finders.FileSystemFinder',
        'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
    )
    

When I do python manage.py collectstatic, I don't get any error but static
folder that's in outer static folder doesn't contain anything. but media
folder that's in static folder contains the files in media folder that's in
project folder.

Also I have this for aws,

    
    
    AWS_FILE_EXPIRE = 200
    AWS_PRELOAD_METADATA = True
    AWS_QUERYSTRING_AUTH = True
    
    DEFAULT_FILE_STORAGE = 'project.utils.MediaRootS3BotoStorage'
    STATICFILES_STORAGE = 'project.utils.StaticRootS3BotoStorage'
    AWS_STORAGE_BUCKET_NAME = 'realproject'
    S3DIRECT_REGION = 'ap-northeast-2'
    S3_URL = '//%s.s3.amazonaws.com/' % AWS_STORAGE_BUCKET_NAME
    MEDIA_URL = '//%s.s3.amazonaws.com/media/' % AWS_STORAGE_BUCKET_NAME
    MEDIA_ROOT = MEDIA_URL
    STATIC_URL = S3_URL + 'static/'
    ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'
    
    import datetime
    
    date_two_months_later = datetime.date.today() + datetime.timedelta(2 * 365 / 12) 
    expires = date_two_months_later.strftime("%A, %d %B %Y 20:00:00 GMT")
    
    AWS_HEADERS = { 
        'Expires': expires,
        'Cache-Control': 'max-age=86400',
    } 
    

Can someone please tell me if I'm doing it right?

by the way, I read <https://docs.djangoproject.com/en/1.9/howto/static-files/>
and followed it, i'm not sure if I followed it right(displayed above) which is
why I'm asking.


Answer: The `python manage.py collectstatic` command looks for all your static
directories and combines those file in the directory defined by the
`STATIC_ROOT` setting.

In your case, `STATIC_ROOT` is set to `os.path.join(os.path.dirname(BASE_DIR),
"static", "static")`, i.e.

    
    
    your_project/static/static
    

So this is where the static files are being collected to. If you want them in
the outer static directory, you can change `STATIC_ROOT` to
`os.path.join(os.path.dirname(BASE_DIR), "static")`.

There is a good discussion of this in the excellent Django [docs
here](https://docs.djangoproject.com/en/1.9/howto/static-files/).

There is quite a lot to take in in these settings, so here is a quick summary
of each static setting as an example:

    
    
    # this is the URL that django will look for static resources at
    # - i.e. http://your_domain/static
    # so this one is a URL used when by your web server and in template
    # shortcuts.
    STATIC_URL = '/static/' 
    
    # this is where Django will look for static files to collect. 
    # I.e. the search locations that collectstatic uses.  
    # 'my_project/static' in this instance. You need to add the places
    # you write your static files to this directory. For example, if you
    # have several places where you are writing css files, add their
    # container directories to this setting.
    # it is a list of places to look for static files.
    STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),) 
    
    # this is where collectstatic will collect the static files to. 
    # When you hook this all into your webserver, you would tell your 
    # webserver that the /static/ url maps to this directory so that 
    # your app can find the static content. It's a directory in your
    # project usually.
    # it's a single directory where the static files are collected together.
    STATIC_ROOT 
    

