Ankzious
Ankzious

Reputation: 325

Django static images aren't displayed

I have deployed one of my project with free version in 'pythonanywhere', but the static images aren't visible in there.

While testing in local everything seems to be working but on deploying and adding static images to it, the images aren't visible there. Please help me find what went wrong here.

In my django templates I used these tags to show images

                    <div class="card-image">
                    <img src="{{cat.category_image.get_photo_url }}">
                    </div>

Or provide me some documentation links to have a look into development issues.

Upvotes: 0

Views: 78

Answers (2)

Ankzious
Ankzious

Reputation: 325

@Giles, cant add an image to the comment. Here is the screenshot from pythonanywhere

enter image description here

Upvotes: 0

GTBebbo
GTBebbo

Reputation: 1218

The documentation for django static files in production is here.

Make sure you run python manage.py collectstatic before you deploy as the local server stores static files in a separate location to the production server. Again, here's the documentation on the collectstatic function.

Upvotes: 2

Related Questions