According to the March 2014 blog post, OpenShift now got rid of some directories like wsgi/, wsgi/static/, data/ and libs/.
Given I used wsgi/static for this purpose, how I am supposed to serve django static files from now on?
django.contrib.staticfiles provides a convenience management command for gathering static files in a single directory so you can serve them easily. Set the STATIC_ROOT setting to the directory from which you’d like to serve these files, for example:
Your project will probably also have static assets that aren’t tied to a particular app. In addition to using a static/ directory inside your apps, you can define a list of directories ( STATICFILES_DIRS) in your settings file where Django will also look for static files.
There are two main ways to structure templates in a Django project as outlined in this tutorial. Let's assume we are using a templates/base.html file for a Blog project. To add our static base.css file to it we'd start by adding {% load static %} at the top of the file and then use the {% static %} tag with the path to it.
By default, Django will look within each app for a static directory containing static files. So if one of your apps was called blog and you wanted to add a CSS file to it called base.css, you need to first create a new directory called blog/static and then add the file within it so the location would be blog/static/style.css.
According to openshift.conf.erb, it seems like it checks if you have a $OPENSHIFT_REPO_DIR/wsgi/static
directory and it keeps it working. I haven't verified that this works, but it looks like it should.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With