Skip to content

Instantly share code, notes, and snippets.

@JuniorLima
Created November 20, 2013 12:16
Show Gist options
  • Save JuniorLima/7562222 to your computer and use it in GitHub Desktop.
Save JuniorLima/7562222 to your computer and use it in GitHub Desktop.
Servir arquivos estáticos localmente - Danilo Teixeira
import os
PROJECT_DIR = os.path.dirname(__file__)
PROJECT_ROOT_PATH = os.path.dirname(os.path.realpath(__file__))
MEDIA_ROOT = os.path.join(PROJECT_DIR, '..', 'media')
MEDIA_URL = '/media/'
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(PROJECT_DIR, '..', 'static'),
)
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # Arquivos enviados pelo usuário
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment