user8686071
user8686071

Reputation:

How do I concatenate 2 strings in Django

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

Answers (1)

Johannes Reichard
Johannes Reichard

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

Related Questions