Bug 962223 - Django 1.4 with Python 2.7 only serving static files with DEBUG=True
Django 1.4 with Python 2.7 only serving static files with DEBUG=True
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Templates (Show other bugs)
2.x
Unspecified Unspecified
medium Severity high
: ---
: ---
Assigned To: Mrunal Patel
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-12 14:15 EDT by burgess.jt
Modified: 2015-05-14 22:22 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-04-24 17:34:30 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description burgess.jt 2013-05-12 14:15:13 EDT
Description of problem:
Like some others, I cannot get static files to work with django and Python-2.7. It works when you add DEBUG=True to the settings.py file, but without that, no static files show up.

I have put the appropriate collect-static call in my deploy script, and I also tried adding a .htaccess file to wsgi, wsgi/static, and both, but that didn't help.

Additional info:
Similar bugs
http://www.openshift.com/forums/openshift/cannot-server-django-27-static-files
https://www.openshift.com/forums/openshift/djangos-not-serving-static-files
Comment 1 Mrunal Patel 2013-05-24 13:28:02 EDT
Same issue as v1.
Comment 2 Nate Aune 2013-06-18 21:20:48 EDT
I'd also like to see a fix for this. I'm currently using Python 2.6 but would like to start using 2.7 cartridge, but not until this is fixed. Running production Django apps in debug mode is not cool.
Comment 3 Jarek Zgoda 2013-09-02 10:58:44 EDT
Things did not change with migration of Python-2.7 cartridge from "community" to "official".
Comment 4 Nate Aune 2013-09-02 14:36:14 EDT
This is how we got it working on OpenShift:
https://appsembler.readthedocs.org/en/latest/static_assets.html
Comment 5 Alex Smith 2014-01-15 14:13:37 EST
I wasn't able to reproduce this issue using python-2.7 and Django 1.4.

What were the steps taken that originally exhibited this issue?
Comment 6 Dave Harlan 2014-01-19 20:01:38 EST
I'm having the same issue with the python-3.3 cartridge and Django 1.6.
Comment 7 Alex Smith 2014-01-20 19:09:31 EST
I can't reproduce this issue with python-3.3 / Django 1.6 either. Static files are being served and DEBUG=False, same as with python-2.7 and Django 1.4.

Please provide:

1. Detailed steps how you're able to provoke the issue.

2. `rhc tail` output that coincides with the issue occurring (with DEBUG=False).


In case you find it helpful for your own debugging, my steps to attempt to reproduce this issue were:

1. Create a python-3.3 / python 2.7 app.

2. For Python 3, install Django using the Django Python 3 quickstart: <https://www.openshift.com/quickstarts/django-16-and-python-3-on-openshift-0>

   For Python 2, I used: <https://www.openshift.com/quickstarts/django>

3. Edit setup.py with 'Django==1.6'

   For Django 1.4, I set: 'Django==1.4'

4. Edit wsgi/openshift/settings.py with DEBUG=False

5. Commit, push app.

6. Test requesting a static file using the browser and curl.
Comment 8 Dave Harlan 2014-01-21 20:42:22 EST
Alex, thank you for your effort with this; I was using a custom setup of Django 1.6 which lacks code to perform the functionality contained in wsgi/openshift/openshiftstaticfiles.py.  I will use the quickstart git repo from now on.  Thanks again!!
Comment 9 XiuJuan Wang 2014-03-31 22:48:03 EDT
Verified on devenv_4607
Reffer to comment 7
A. python-3.3/ django 1.6
1. rhc app create django33 python-3.3
2. #cd django33
   #git remote add upstream -m master git://github.com/rancavil/django-py3-openshift-quickstart.git
   #git pull -s recursive -X theirs upstream master
3. Edit setup.py with 'Django==1.6'
4. Edit wsgi/openshift/settings.py with DEBUG=False
5. Commit push app
Will show static files copying debug info.
<----snip-----> 
remote: Copying '/var/lib/openshift/533a233f778b13ab4100003a/python/virtenv/venv/lib/python3.3/site-packages/Django-1.6-py3.3.egg/django/contrib/admin/static/admin/img/gis/move_vertex_on.png'
remote: 
remote: 69 static files copied.
<----snip---->
6.Test requesting a static file using the browser.
Could see the static file.
http://django33-adog.dev.rhcloud.com/static/admin/img/gis/move_vertex_on.png

B. python 2.7/ django 1.4
1.rhc app create django27 python-2.7
2.cd django27
git remote add upstream -m master git://github.com/openshift/django-example.git
git pull -s recursive -X theirs upstream master
3. Edit setup.py with 'Django==1.4'
4. Edit wsgi/openshift/settings.py with DEBUG=False
5. Commit push app
Same info with A->5 step
6.Test requesting a static file using the browser.
Could see the static file.

Mark this bug as VERIFIED.

Note You need to log in before you can comment on or make changes to this bug.