# Revision history [back]

### compressor.py doesnt have the correct permissions when debug=true

I have an openstack server. It has a couple of custom dashboards added to it. Horizon works just fine when DEBUG in local_settings.py is set to False and loads the custom dashboard quite nicely. But when i set it to True for production needs, trying to access the custom panels, i get an error:

OSError at /neo/custom/dashboard/
[Errno 13] Permission denied: '/usr/share/openstack-dashboard/static/dashboard/css/b4cc9f997a3e.css'
Error during template rendering
In template /usr/lib/python2.7/site-packages/horizon/templates/horizon/_scripts.html


When i follow through the error down to the actual function that throws this error, it is an os.open function trying to create a new file

/usr/lib/python2.7/site-packages/django/core/files/storage.py in _save
# This is a normal uploadedfile that we can stream.
else:
# This fun binary flag incantation makes os.open throw an
# OSError if the file already exists before we open it.
flags = (os.O_WRONLY | os.O_CREAT | os.O_EXCL |
getattr(os, 'O_BINARY', 0))
# The current umask value is masked out by os.open!
fd = os.open(full_path, flags, 0o666) ...
_file = None
try:
locks.lock(fd, locks.LOCK_EX)
for chunk in content.chunks():
if _file is None:
mode = 'wb' if isinstance(chunk, bytes) else 'wt'


Full error dump can be found here : http://pastebin.com/2Qb3MTLJ

As far as i can understand, the problem is being caused when compressor.py is trying to create a static file to send back to the client, but is unable to do it, because it doesn't have the correct permissions. But it works just fine when Debug is set to False. So after some googling, i found out that when debug is set to true, the django server runs under a different user and thus has different permissions. My question is, under which user does the django server run, when debug is set to true?

The file permissions in the static folder (the folder that compressor.py fails to create files in) so far are

drwxr-xr-x. 7 root      root      72 Nov  7 08:37 .
drwxr-xr-x. 4 root      root      95 Sep 30 15:16 ..
drwxr-xr-x. 5 root      root      36 Sep 30 15:16 bootstrap
drwxr-xr-x. 7 root      root      78 Nov  7 09:01 dashboard
drwxr-xr-x. 5 root      root      37 Sep 30 15:16 horizon
drwxr-xr-x. 5 root      root      35 Nov  7 08:37 neo
drwxr-xr-x. 5 root      root      35 Nov  7 08:36 vnf


with the last two folders being the custom dashboard ones. I've tried to set all owners of all of these folders recursively to root, apache, nobody and other users. That didn't change anything.

So if i'm correct in assuming that this is my fault for not having the correct permissions and owners for my static directory, then what kind of permissions should there be? What is the user that the django server runs as when debug=true? If i'm wrong, then what else could cause this error only when trying to open custom dashboards and only when debug=true?

the horizon version is

python-django-horizon.noarch                2014.1.2-2.el7.centos      @openstack-icehouse
python-django-horizon.noarch                2014.1.3-1.el7.centos      openstack-icehouse
python-django-horizon-doc.noarch            2014.1.3-1.el7.centos      openstack-icehouse