Reputation:
I need to show an image of the database, but I need to insert a slash before {{...}} because only then does the file access the static folder. What should I do?
Upvotes: 0
Views: 158
Reputation: 947
You can do this like recommended in the two comments but actually django coveres this exact usecase. What you are searching is an administration of your static files, the docs are here: https://docs.djangoproject.com/en/1.11/howto/static-files/ .
If you want to have your files organised with the orm, checkout https://docs.djangoproject.com/en/1.11/topics/files/ especially the second code snippet. A File object gives you a name
, path
and url
which should cover all your needs including absolute and relativ paths for your files.
Upvotes: 3