Monday, 19 August 2013

ImproperlyConfigured at /url/ - /static/ isn't a storage module

ImproperlyConfigured at /url/ - /static/ isn't a storage module

I am trying to upload a file.
this is my model.
def custom_path(instance, filename):
return '/'.join(['upload',instance.student.user.username,filename])
class Doc(models.Model):
uploadtime = models.DateTimeField(auto_now_add=True, blank=True)
datei = models.FileField(upload_to=custom_path,default='')
student = models.ForeignKey(Student,related_name='students_file')
title = models.TextField()
desc = models.TextField()
def __unicode__(self):
return self.title
and this is my views.py
def hochgeladen_danke(request):
if request.FILES.get('file'):
student = request.user.get_profile()
student.students_file.create(datei=request.FILES.get('file'),title='t',desc='t')
return
render_to_response('upload.html',{},context_instance=RequestContext(request))
my html:
<form action="/hochgeladen_danke/" method="post"
enctype="multipart/form-data">
{% csrf_token %}
File: <input type="file" name="file"/>
<button type="submit">upload</button>
</form>
my settings.py:
MEDIA_ROOT = os.path.join(PROJECT_PATH, "media")
MEDIA_URL = "/media/"
STATIC_ROOT = os.path.join(PROJECT_PATH, "static")
STATIC_URL = '/static/'
when i try to upload a file. it is saying:
ImproperlyConfigured at /hochgeladen_danke/
/static/ isn't a storage module.
i dont know why this is happening. my custom_path seems to be right.
need badly help

No comments:

Post a Comment