Self hosted FLOSS fitness/workout, nutrition and weight tracker
Add MEDIA_ROOT to default settings.py file
Roland Geider607e12f07d0a
diff --git a/wger/exercises/management/commands/download-exercise-images.py b/wger/exercises/management/commands/download-exercise-images.pyindex 34580cad3..e33dc5a94 100644--- a/wger/exercises/management/commands/download-exercise-images.py+++ b/wger/exercises/management/commands/download-exercise-images.py@@ -19,11 +19,13 @@ import urllibimport osfrom optparse import make_option+from django.core.exceptions import ImproperlyConfiguredfrom django.core.management.base import BaseCommandfrom django.core.management.base import CommandErrorfrom django.core.files import Filefrom django.core.validators import URLValidatorfrom django.core.exceptions import ValidationError+from django.conf import settingsfrom wger.exercises.models import Exercisefrom wger.exercises.models import ExerciseImage@@ -55,6 +57,9 @@ class Command(BaseCommand):def handle(self, *args, **options):+ if not settings.MEDIA_ROOT:+ raise ImproperlyConfigured('Please set MEDIA_ROOT in your settings file')+remote_url = options['remote_url']val = URLValidator()try:diff --git a/wger/main.py b/wger/main.pyindex fadfaf51d..e0c11904f 100755--- a/wger/main.py+++ b/wger/main.py@@ -71,6 +71,14 @@ SITE_URL = '%(siteurl)s'# This might be a good idea if you setup memcached#SESSION_ENGINE = "django.contrib.sessions.backends.cache"+++# Path to uploaded files+MEDIA_ROOT = '%(media_folder_path)s'+MEDIA_URL = SITE_URL + '/static/'+if DEBUG:+ # Serve the uploaded files like this only during development+ STATICFILES_DIRS = (MEDIA_ROOT, )"""KEY_LENGTH = 30@@ -224,6 +232,7 @@ def create_settings(settings_path, database_path=None, url=None):database_path = get_user_data_path('wger', 'database.sqlite')dbpath_value = repr(fs2unicode(database_path))+ media_folder_path = get_user_data_path('wger', 'media')print "Please edit your settings file and enter the values for the reCaptcha keys "print "You can leave this empty, but won't be able to register new users"recaptcha_public_key = ''@@ -265,7 +274,8 @@ def create_settings(settings_path, database_path=None, url=None):dbport=dbport,siteurl=url,recaptcha_public_key=recaptcha_public_key,- recaptcha_private_key=recaptcha_private_key)+ recaptcha_private_key=recaptcha_private_key,+ media_folder_path=media_folder_path)if not os.path.exists(settings_module):os.makedirs(settings_module)