0

I am deploying an Django app to Stackato. Everything works fine except static files. According to the documentation, here is my setting in .yml file:

processes:
  web: $STACKATO_UWSGI --static-map /static=$HOME/static

And here is my local setting.py:

STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(PROJECT_PATH, "static"),
    '/var/www/static/',
)

Also, here is my project structure

Project -- .....
           |
            static -- css
                  |
                   -- images

I did not see any error from the log. Any idea?

Hua2308
  • 451
  • 6
  • 14

2 Answers2

0

Your configuration should work. Specifically assets in your static/css and static/images directories will be available via urls like http://your-stackato-host/static/css/yourstyle.css.

To help troubleshoot this I created a bare-bones example on github which you can clone and push to Stackato to verify it's working.

0

Just figured it out:

1.While settings.DEBUG is set to True, static url pattern has to be included:

from django.contrib.staticfiles.urls import staticfiles_urlpatterns
if settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()

2.Static files should follow this structure:

Project -- <app 'Project'> -- settings.py
           |                  |
           |                  -- urls.py
           |                  |
           |                  -- wsgi.py
           |
           -- <app 'somename'> -- ..
                            |
                            -- static -- <app 'somename'> -- css - a.css
                                                          |
                                                          -- images - a.jpg

3.STATIC_ROOT should not be the actual location of static directory, which could be as this: Project/Project/static, while STATICFILES_DIRS has to be the actual static files directory which is Project/somename app/static

Reference: https://github.com/mozilla/mozmoderator

Hua2308
  • 451
  • 6
  • 14