Feeds:
文章
评论

Archive for 2016年1月

Environments

Openshift cartridges: python 2.7

Django 1.8

According to this thread, “Files in $OPENSHIFT_REPO_DIR/wsgi/static folder are served by Apache directly”, so we have the following setting works well.

setting.py

STATIC_URL = ‘/static/’

STATIC_ROOT = os.path.join(DJ_PROJECT_DIR, ‘../../static’)

STATICFILES_FINDERS = (

    ‘django.contrib.staticfiles.finders.FileSystemFinder’,

    ‘django.contrib.staticfiles.finders.AppDirectoriesFinder’,

)

STATICFILES_DIRS = (

    os.path.join(DJ_PROJECT_DIR, ‘../../dist’),

)

Note:

1) STATIC_URL and STATIC_ROOT map yourdomain.com/static/ to the $OPENSHIFT_REPO_DIR/wsgi/static.

2) We also set STATICFILES_DIRS to wsgi/dist as we also use browserify to bundle the sources, which are in /wsgi/static_src

3) Collecting static files to STATIC_ROOT is part of openshift’s deploy job. See the 4th step of this instruction.

 

Advertisements

Read Full Post »