Comments (14)
@rhcarvalho or @GrahamDumpleton can you help here?
from django-ex.
there's a link in that settings file that tells you how to deal with them,
for what i can tell there's no static directory in this projects because we have everything (css/js) in the template file
from django-ex.
and the link: https://docs.djangoproject.com/en/1.8/howto/static-files/
from django-ex.
Thanks @PI-Victor but you can imagine that I already done that.
My project works fine in local.
I tried several configurations and you can find more informations on my post : http://stackoverflow.com/questions/37845189/static-files-on-openshift-with-django
Thanks
from django-ex.
Hi @general03, looking at your SO post, I think you're working with OpenShift v2, where you have cartridges and so on (current OpenShift Online offering).
This example repository is meant for use with OpenShift v3. Doesn't mean you get no help :)
When you run Django in production (debug=False), you need to handle serving static files by some other means.
- One way to do it is to setup a HTTP server like httpd or nginx.
- Or use a pure-Python solution like this repo is configured to use WhiteNoise.
Looking at the implementation for the Python Cartridge, there's indeed an option to place files in $OPENSHIFT_REPO_DIR/wsgi/static
:
<% #Backward compatibilty with wsgi/static/ directory
if $SAFE!=2 && (File.directory?("#{ENV['OPENSHIFT_REPO_DIR']}wsgi/static") || File.symlink?("#{ENV['OPENSHIFT_REPO_DIR']}wsgi/static"))
%><%= "Alias /static #{ENV['OPENSHIFT_REPO_DIR']}wsgi/static" %><%
end
%>
So I suspect if you drop your static files in wsgi/static
in your project repository it should work.
Definitely there must be some official documentation for that, @bparees any pointers?
from django-ex.
@rhcarvalho good catch. I can't seem to dig up any useful v2 python docs at the moment, but maybe @dinhxuanvu has a pointer.
from django-ex.
It doesn't look like we have an official document for this unfortunately or at least I couldn't find it anywhere. However, @rhcarvalho comment is correct regarding where to put static files $OPENSHIFT_REPO_DIR/wsgi/static
. So his advice is the way to go.
Also, I found this post that looks useful. Please take a look: StackOverflow
Thanks.
from django-ex.
If you need a v2 version for django, try mine :)
https://github.com/jfmatth/openshift-django
from django-ex.
We do have a Django example for V2 which is https://github.com/openshift/django-example
from django-ex.
@jfmatth Sorry pal :D... I couldn't resist stealing your thunder :P...
from django-ex.
No worries, it's all free open source anyway, that's the way we do it.
But if ur at summit today, you can buy me a drink :)
On Jun 30, 2016 11:26 AM, "Vu Dinh" [email protected] wrote:
@jfmatth https://github.com/jfmatth Sorry pal :D... I couldn't resist
stealing your thunder :P...—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#48 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AARpsg5RzugTvi8nuMb3jZ0v6bXLlM5sks5qRApKgaJpZM4JA1W5
.
from django-ex.
Haha. Sorry, I'm not at the Summit this year but next year when Summit is back in Boston, I owe you one :D.
from django-ex.
In the wsgi.py I have to have
sys.path.append(os .path.join(os.environ['OPENSHIFT_REPO_DIR']))
os.environ['DJANGO_SETTINGS_MODULE' ] = 'project.settings.app'
and in my settings.py
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
wsgi.py
from django-ex.
You should checkout my repo, those changes aren't required :).
good luck
from django-ex.
Related Issues (20)
- Contribution: Flask-ex (based on this repo) HOT 2
- Update example in readme to Python to 3.6 HOT 1
- upgrade psycopg2 to 2.7.7 HOT 1
- Changes for django 2.1 support HOT 1
- Unable to start django HOT 2
- add new build environment variable to allow this template to be easily deployed in air gapped environments HOT 1
- Update unicorn to 19.10.0
- Upgrade to Django 2.2 HOT 1
- Dead links HOT 1
- Different database password in Django and PostgreSQL containers HOT 2
- Branch 2.2.x sqlite version problem HOT 2
- Master branch suggest old Django version HOT 3
- module_path, class_name = dotted_path.rsplit('.', 1) ValueError: not enough values to unpack (expected 2, got 1) HOT 4
- Django 3.2 LTS
- Example Django apps do not work with FIPS enabled clusters HOT 9
- ImproperlyConfigured HOT 1
- Testing issue creation for samples operator HOT 1
- No Action Required !! Testing automation workflow HOT 1
- Django 4.2 LTS is out HOT 2
- Adding a template for using css HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-ex.