2016-07-01 2 views
0

POST시 Heroku의 Filebrowser & S3를 사용하여 500 오류가 발생합니다. 스택 추적 및 모델 정보를 추가했습니다 :) 이것이 S3 문제 또는 Filebrowser와 관련이 있는지 알 수 있습니까? 터미널에서Heroku + S3의 Django-Filebrowser 500 오류

스택 추적 :

file = FileBrowseField("HTML or ZIP File", max_length=256, blank=True, null=True, extensions=[".zip",".html"], help_text="Upload an html file or a zip file of banners") 

def save(self, *args, **kwargs): 
    self.slug = slugify(self.name) 

    super(BannerCode, self).save(*args, **kwargs) 

def __unicode__(self): 
    return self.name 

def post_upload_callback(sender, **kwargs): 
    if kwargs['file'].extension == ".zip": 
     path = kwargs['path'] 
     thefile = kwargs['file'] 

     # Convert file and dir into absolute paths 
     fullpath = os.path.join(settings.MEDIA_ROOT, '' + thefile.path) 
     dirname = os.path.dirname(fullpath) 

     # Get a real Python file handle on the uploaded file 
     fullpathhandle = open(fullpath, 'r') 

     # Unzip the file, creating subdirectories as needed 
     zfobj = zipfile.ZipFile(fullpathhandle) 
     for name in zfobj.namelist(): 
      if name.endswith('/'): 
       try: # Don't try to create a directory if exists 
        os.mkdir(os.path.join(dirname, name)) 
       except: 
        pass 
      else: 
       outfile = open(os.path.join(dirname, name), 'wb') 
       outfile.write(zfobj.read(name)) 
       outfile.close() 

     # Now try and delete the uploaded .zip file and the __MACOSX dir if they exist. 
     try: 
      os.remove(fullpath) 
     except: 
      pass 

     try: 
      osxjunk = os.path.join(dirname,'__MACOSX') 
      shutil.rmtree(osxjunk) 
     except: 
      pass     

# Signal provided by FileBrowser on every successful upload. 
filebrowser_post_upload.connect(post_upload_callback) 

심지어이 하나의 디버깅을 시작하는 방법을 잘 모르겠어요 : 여기

[01/Jul/2016 05:19:10] "GET /admin/filebrowser/browse/?pop=1&dir=300x250/160x600 HTTP/1.1" 500 76295 
Internal Server Error: /admin/filebrowser/browse/ 
Traceback (most recent call last): 
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 149, in get_response 
response = self.process_exception_by_middleware(e, request) 
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response 
response = wrapped_callback(request, *callback_args, **callback_kwargs) 
File "/Users/scott/Sites/banner_preview_tool_venv/banner_preview_tool/filebrowser/decorators.py", line 35, in decorator 
if get_path('', site=site) is None: 
File "/Users/scott/Sites/banner_preview_tool_venv/banner_preview_tool/filebrowser/decorators.py", line 18, in get_path 
if site.storage.isdir(converted_path): 
File "/usr/local/lib/python2.7/site-packages/django/utils/functional.py", line 205, in inner 
return func(self._wrapped, *args) 
AttributeError: 'MediaStorage' object has no attribute 'isdir' 
2016-07-01 05:19:14,947 ERROR Internal Server Error: /admin/filebrowser/browse/ 
Traceback (most recent call last): 
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 149, in get_response 
response = self.process_exception_by_middleware(e, request) 
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response 
response = wrapped_callback(request, *callback_args, **callback_kwargs) 
File "/Users/scott/Sites/banner_preview_tool_venv/banner_preview_tool/filebrowser/decorators.py", line 35, in decorator 
if get_path('', site=site) is None: 
File "/Users/scott/Sites/banner_preview_tool_venv/banner_preview_tool/filebrowser/decorators.py", line 18, in get_path 
if site.storage.isdir(converted_path): 
File "/usr/local/lib/python2.7/site-packages/django/utils/functional.py", line 205, in inner 
return func(self._wrapped, *args) 
AttributeError: 'MediaStorage' object has no attribute 'isdir' 

그리고 모델입니다. 누구든지이 사실에 대해 통찰력을 갖고 있습니까? 고마워!

+0

을 @solarissmoke. – solarissmoke

+0

위의 추가 :-) thanks –

+0

'MediaStorage'는 어디에서 왔습니까? 귀하가 구성한 스토리지 백엔드를 알려주십시오. – solarissmoke

답변

0

Filebrowser가 장고 - 스토리지와 호환되지 않습니다 ...이 답변을 잊어 버렸습니다.

덕분에 우리에게 전체 스택 추적 및 오류가 ;-) 시작하는 좋은 장소가 될 것이다 생성하는 코드를 표시