title: Is a directory Error in Django deployment
body: <p>I am building a website with django for months. So now i thought its time to test it with some friend. While deploying it to a Ubuntu 14.4 64bit LTS ( Same as development environment ) i found a strange error. </p>
  
  <p>Called</p>
  
  <pre><code>OSError at /accounts/edit/
  [Errno 21] Is a directory: '/var/www/media/'
  </code></pre>
  
  <p>I also tried with different path <code>BASE_PATH + "/media"</code> Which was ok for my development.</p>
  
  <p>I am running the default django development server (As its a test!)</p>
  
  <p>It will be really awesome if someone correct me and teach me what's wrong here.</p>
  
  <p>Thanks. </p>
  
  <p>Edit: (Traceback)</p>
  
  <pre><code>Environment:
  
  
  Request Method: POST
  Request URL: http://playbox.asia:8000/accounts/edit/
  
  Django Version: 1.6.4
  Python Version: 2.7.6
  Installed Applications:
  ('django.contrib.admin',
   'django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.messages',
   'django.contrib.staticfiles',
   'south',
   'easy_pjax',
   'bootstrap3',
   'djangoratings',
   'taggit',
   'imagekit',
   'playbox',
   'accounts',
   'musics',
   'playlist')
  Installed Middleware:
  ('django.contrib.sessions.middleware.SessionMiddleware',
   'django.middleware.common.CommonMiddleware',
   'django.middleware.csrf.CsrfViewMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware',
   'django.contrib.messages.middleware.MessageMiddleware',
   'django.middleware.clickjacking.XFrameOptionsMiddleware')
  
  
  Traceback:
  File "/root/playbox/venv/local/lib/python2.7/site-        packages/django/core/handlers/base.py" in get_response
    114.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/root/playbox/venv/local/lib/python2.7/site-        packages/django/contrib/auth/decorators.py" in _wrapped_view
    22.                 return view_func(request, *args, **kwargs)
  File "/root/playbox/accounts/views.py" in edit
    189.                 os.remove(settings.MEDIA_ROOT + "/" + profile.avatar.name)
  
  Exception Type: OSError at /accounts/edit/
  Exception Value: [Errno 21] Is a directory: '/var/www/media/'
  </code></pre>