Bug 962223 - Django 1.4 with Python 2.7 only serving static files with DEBUG=True
Summary: Django 1.4 with Python 2.7 only serving static files with DEBUG=True
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Templates
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: ---
: ---
Assignee: Mrunal Patel
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-12 18:15 UTC by burgess.jt
Modified: 2015-05-15 02:22 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-04-24 21:34:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description burgess.jt 2013-05-12 18:15:13 UTC
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 17:28:02 UTC
Same issue as v1.

Comment 2 Nate Aune 2013-06-19 01:20:48 UTC
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 14:58:44 UTC
Things did not change with migration of Python-2.7 cartridge from "community" to "official".

Comment 4 Nate Aune 2013-09-02 18:36:14 UTC
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 19:13:37 UTC
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-20 01:01:38 UTC
I'm having the same issue with the python-3.3 cartridge and Django 1.6.

Comment 7 Alex Smith 2014-01-21 00:09:31 UTC
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-22 01:42:22 UTC
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-04-01 02:48:03 UTC
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.