user3458489
user3458489

Reputation: 1

Static files (images, css) are not being served Openshift 2014, Django 1.4 and Python 2.7

I am having a trouble hosting static images in Openshift 2014. I have tried quite a bit with htaccess setting files etc after going through internet. The problem seems to be Openshift's change in directory patterns. It has removed folders such as wsgi https://www.openshift.com/blogs/openshift-online-march-2014-release-blog.

Can anyone kindly help me in figuring out this problem?

Observations

  1. The website, images css files all seem to work in debug=true mode.

Upvotes: 0

Views: 794

Answers (1)

Guillaume
Guillaume

Reputation: 51

I got the same problem: Not getting the Template Repository Layout after deploying Python 2.7 on openshift

After inspecting the Apache configuration on the server, I found that wsgi/static is still served statically by Apache. So I simply did this in my repo:

mkdir wsgi
cd wsgi
ln -s ../mypackage/static

In addition you can add the following line your build hook to serve the media files

if [ ! -d $OPENSHIFT_DATA_DIR/media ]; then
    mkdir $OPENSHIFT_DATA_DIR/media
fi
ln -sf $OPENSHIFT_DATA_DIR/media $OPENSHIFT_REPO_DIR/wsgi/static/media

Upvotes: 1

Related Questions