Skip to content

Instantly share code, notes, and snippets.

@richellyitalo
Last active March 12, 2019 05:43
Show Gist options
  • Save richellyitalo/a252d61982c07872720800b8604273a4 to your computer and use it in GitHub Desktop.
Save richellyitalo/a252d61982c07872720800b8604273a4 to your computer and use it in GitHub Desktop.

Nos settings do projeto 'settings.py'

# Configuração static
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'PASTA_APP/static/')
]

# Configuração dos arquivos de mídia (upload)
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

Nas urls 'urls.py'

from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    # ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment