diff --git a/project/project_name/settings/base.py b/project/project_name/settings/base.py --- a/project/project_name/settings/base.py +++ b/project/project_name/settings/base.py @@ -5,6 +5,12 @@ # project. Do not put any site-specific settings here. # +from os import path + +# Determine the Django project root directory. +PROJECT_ROOT = path.dirname(path.dirname(path.abspath(__file__))) +ASSETS_ROOT = path.normpath(path.join(PROJECT_ROOT, "assets")) + # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'en-us' @@ -22,20 +28,17 @@ USE_L10N = True # If you set this to False, Django will not use timezone-aware datetimes. USE_TZ = True -# Absolute filesystem path to the directory that will hold user-uploaded files. -# Example: "/var/www/example.com/media/" -MEDIA_ROOT = '' +# Absolute filesystem path to the directory that will hold user-uploaded +# files. Calculated based on project root. +MEDIA_ROOT = path.normpath(path.join(ASSETS_ROOT, "media")) # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. -# Examples: "http://example.com/media/", "http://media.example.com/" -MEDIA_URL = '' +MEDIA_URL = '/media/' -# Absolute path to the directory static files should be collected to. -# Don't put anything in this directory yourself; store your static files -# in apps' "static/" subdirectories and in STATICFILES_DIRS. -# Example: "/var/www/example.com/static/" -STATIC_ROOT = '' +# Absolute path to the directory static files should be collected to. Calculated +# based on project root. +STATIC_ROOT = path.normpah(path.join(ASSETS_ROOT, "static")) # URL prefix for static files. # Example: "http://example.com/static/", "http://static.example.com/" @@ -92,7 +95,7 @@ INSTALLED_APPS = ( 'django.contrib.messages', 'django.contrib.staticfiles', # Uncomment the next line to enable the admin: - # 'django.contrib.admin', + 'django.contrib.admin', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', )