Mayan-Edms IOError: [Errno 13] Permission denied

Here is what to do when faced with an error resembling the following:


/usr/share/mayan-edms/lib/python2.7/site-packages/ to pythonpath.
Traceback (most recent call last):
File "/usr/share/mayan-edms/lib/python2.7/site-packages/mayan/wsgi.py", line 16, in 
application = get_wsgi_application()
File "/usr/share/mayan-edms/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
django.setup(set_prefix=False)
File "/usr/share/mayan-edms/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/share/mayan-edms/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/share/mayan-edms/lib/python2.7/site-packages/django/apps/config.py", line 116, in create
mod = import_module(mod_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/share/mayan-edms/lib/python2.7/site-packages/mayan/apps/checkouts/apps.py", line 29, in 
from .tasks import task_check_expired_check_outs # NOQA
File "/usr/share/mayan-edms/lib/python2.7/site-packages/mayan/apps/checkouts/tasks.py", line 8, in 
from lock_manager.runtime import locking_backend
File "/usr/share/mayan-edms/lib/python2.7/site-packages/mayan/apps/lock_manager/runtime.py", line 5, in 
locking_backend = import_string(setting_backend.value)
File "/usr/share/mayan-edms/lib/python2.7/site-packages/django/utils/module_loading.py", line 20, in import_string
module = import_module(module_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/share/mayan-edms/lib/python2.7/site-packages/mayan/apps/lock_manager/backends/file_lock.py", line 25, in 
open(lock_file, 'a').close()
IOError: [Errno 13] Permission denied: u'/tmp/mayan_locks.tmp'
unable to load app 0 (mountpoint='') (callable not found or import e

Simply change the permission of the /tmp folder like so:

chown -R www-data:www-data /tmp/

That should fix the issue.

Thoughts ?

Add class attribute to Django form fields

Having realized how hard it is to manually write code to display django form, I decided to implement a small hack to enable me attach bootstrap classes to django form fields.

 

  1. Create a python file under the templatetags folder in your django project.
  2. In this file (named say, my_form_tag.py) add the following:
    from django.template import Library
    
    register = Library()
    
    @register.filter(name='addclass')
    def addclass(field, class_attr):
        return field.as_widget(attrs={'class': class_attr})
    
  3. In the rendered html template, load the file with the template tags and use it to relike so
<html>

{% load staticfiles %}
{% load my_form_tag %}

4. Use the tag in the body of your page

   {{ field | addclass:"form-control" }}

Docker: re-exec error: exit status 1: output: write /var/lib/mysql/ibdata1: no space left on device

I usually find myself in a very annoying situation where my docker containers keeping getting full anytime I am building mysql containers.

Here are the series of steps I employ to get myself rid of such issues.

boot2docker config > ~/.boot2docker/profile

change the line with DiskSize from DiskSize = 20000 to 24000
Feel free to increase this number to your choice.

boot2docker poweroff

boot2docker destroy

Eclipse Tomcat not starting in 45 seconds (Solution ?)

In a bid to keep my Java skills alive, I decided to start from the ground up, from Servlets to EJB’s using Eclipse. I hit a stumbling block anytime I tried to start the Tomcat Server v. 7. I pops up this annoying “Tomcat not starting in 45 seconds”. One may be tempted to increase the timeout period but that barely solves the problem.

Try the following first.

1. http://crunchify.com/step-by-step-guide-to-setup-and-install-apache-tomcat-server-in-eclipse-development-environment-ide/

2. https://sansatechnology.wordpress.com/2011/09/26/how-to-fix-eclipse-tomcat-not-starting-in-45-seconds/

If the above fails, do the following.

1. Setup your eclipse + tomcat as per point 1.

2. Now eclipse views the Server as a project. So click on “Servers” under the Project Explorer Tab.

3. Click on the drop down part of the “Run button” and choose the first option like the image below.

Screen Shot 2015-06-20 at 10.23.54 PM

4. Did it work ?