# configuring MEDIA_URL with pre-existing project

I have integrated askbot into a pre-existing project. In that project i have MEDIA_* variables set as follows:

MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')
MEDIA_URL = '/media/'


The issue is that with those settings if I try and upload an image with a question in askbot it attempts to write it at <project_dir>/media/

I would rather it write to <project_dir>/askbot/upfiles as it would if I used the default settings askbot generates:

MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'askbot', 'upfiles')
MEDIA_URL = '/upfiles/'


I know that I can create new variables and use those, but I was wondering if there was an easy way with askbot to have askbot use the path it wants to go to upfiles and the rest of my project to use the paths I have already defined.

I saw this question but ASKBOT_FILE_UPLOAD_DIR does not change things, and I noticed that django.core.files.storage.get_storage_class is used in store_file so it is using the MEDIA_ROOT and MEDIA_URL there. Not sure if there is a nice way to have askbot point to a different location.

edit retag close merge delete