2011-08-14 2 views
1

dotcloud에 django 앱을 업로드하는 데 문제가 있습니다. 나는 정적/admin_media /에 장고의 관리자 패널 정적 파일을 변경하려면 아래의 코드를 사용하고 있지만, 그것은 나에게 다음과 같은 배포 오류 제공 :정적 폴더 이동 문제

2011-08-14 13:22:35 [www.0] Traceback (most recent call last): 
2011-08-14 13:22:35 [www.0] File "./postinstall", line 23, in <module> 
2011-08-14 13:22:35 [www.0]  os.symlink(mediadir, staticlink) 
2011-08-14 13:22:35 [www.0] OSError: [Errno 2] No such file or directory 

및 코드 :

import os 
# To import anything under django.*, we must set this variable. 
os.environ['DJANGO_SETTINGS_MODULE'] = 'kalvin.settings' 
# Import the admin module. The media directory is right under it! 
import django.contrib.admin 
# Retrieve the absolute path of the admin module. 
admindir = os.path.dirname(django.contrib.admin.__file__) 
# Add /media behind it. 
mediadir = os.path.join(admindir, 'media') 
# Compute the path of the symlink under the static directory. 
staticlink = os.path.join('static', 'admin_media') 
# If the link already exists, delete it. 
if os.path.islink(staticlink): 
    os.unlink(staticlink) 
# Install the correct link. 
os.symlink(mediadir, staticlink) 
+0

질문 제목을 수정하십시오. 기술 목록 (태그에 이미 포함되어 있음, btw)은 질문을 설명하지 않습니다. –

답변

0

솔루션을 this answer입니다.

static이라는 빈 폴더가 필요했지만 git은 비어있어서 서버에 전송하지 않았습니다.

폴더 안에 .gitignore을 만들면 문제가 해결됩니다.