2014-04-22 26 views
38

Ben yeniyim django! Ben komut python manage.py collectstatic kullandığınızda bu hatayıKoleksiyon oluşturulamıyor

django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path 

olsun Ama başarıyla sunucuyu çalıştırabilir.

Benim statik dosyalar bildirimleri şunlardır:

DEBUG = True 

Bunu nasıl düzeltebilirim

STATIC_ROOT = '' 

STATIC_URL = '/static/' 


STATICFILES_DIRS = (

    ('assets', os.path.join(PROJECT_DIR, '../static')), 
) 

ve ayıklama true olarak ayarlanır? Diğer kurulum paketleri eksik mi?

+2

Bu çok açık hata mesajı hakkında ne anlama geliyor? STATIC_ROOT'u bir dosya yoluna ayarlamadınız. –

+0

heroku http://stackoverflow.com/questions/21141315/django-static-files-on-heroku –

cevap

80

bu deneyin,

PROJECT_DIR = os.path.dirname(os.path.abspath(__file__)) 
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static') 

Bak https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-STATIC_ROOT

de
+0

Teşekkürler :) Çalışmaları! Bu uygulamayı boş olarak statik kök ile kullanmadan önce. Ama işe yaradı! Şimdi sorun ne olabilir? – user3383301

+0

Statik klasörü tanımlamanız gerekir. Tüm statik dosyalar bu klasörde toplanır. 'STATIC_ROOT ayarını bir dosya sistemi yoluna ayarlamadan staticfiles uygulamasını kullanıyorsunuz ' – dhana

+0

Okayy teşekkürler :) – user3383301

8

Sen tüm statik dosyalar örnek olarak toplandığı yerle settings.py içinde STATIC_ROOT yolu vermek zorunda gerekir: -

STATIC_ROOT = "app-root/repo/wsgi/static" 

STATIC_URL = '/static/' 

STATICFILES_DIRS = (
    ('assets', 'app-root/repo/wsgi/openshift/static'), 

    )