Created
November 20, 2013 12:16
-
-
Save JuniorLima/7562222 to your computer and use it in GitHub Desktop.
Servir arquivos estáticos localmente - Danilo Teixeira
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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