general03 general03 - 1 year ago 200
Python Question

Static files on Openshift with Django

I can't found my static files like css, js and picture. I get 404 error page.

In my settings django I have

STATIC_ROOT = '/var/lib/openshift/*id*/app-root/repo/*project*/*app*'
STATIC_URL = '/static/'

and my filesystem are

- project
- app
- static # I also tried to move this folder in wsgi folder
- css
- base.css
- ...

I tried to move the static folder in wsgi folder created before.
I also tried to move my static folder or wsgi folder in data folder of openshift without success.

I follow few help posts from Stackoverflow without found my answer

Can you help me to configure my static folder ?


Answer Source

In the I have to have sys.path.append(os.path.join(os.environ['OPENSHIFT_REPO_DIR'])) os.environ['DJANGO_SETTINGS_MODULE' ] = '' and in my STATIC_ROOT = os.path.join(os.getenv('OPENSHIFT_REPO_DIR'), 'wsgi/static', ) STATIC_URL = '/static/' And the filesystem of my website repo project ... wsgi static

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download