Closed alaorneto closed 6 years ago
Apologies for the late response.
You solved it, or gave up, or still need help?
I gave up, actually.
For your case it can be achieved as following:
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/upload/'
MARKDOWNX_MEDIA_PATH = datetime.now().strftime('%Y/%m/%d')
...
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
As described in official django documents, it is not the best idea to serve static files like the way above. However, if your contents are not updated very frequently it should be fine.
I'm following the tutorial to test markdownx, but I'm facing a problem.
My project is called "theproject", then I have my form inside an app, let's say "myapp".
I have set the following variables in my project's settings.py:
When I drag some jpeg to the editor, it gets upload to /theproject/media/upload/YYYY/MM/DD/.
But the GET request is being made to /myapp/upload/YYYY/MM/DD, so I get an 404 error and the image is not shown.
How can I solve this?