I've tried inserting "static" in the tag but doesnt return the image. Rather it returns a white box. Users are able to upload their own pictures. The directory where this is stored is Aviation -> Uploads -> Aircraft. Where exactly am I going wrong?
list.html
<div class="box"><img src="{{ aircraft.image }}" /> Settings. py
STATIC_URL = '/static/' STATICFILES_DIRS = [ map_path('static'),] MEDIA_ROOT = os.path.join(BASE_DIR,'media') MEDIA_URL = '/media/' View.py
def list_aircraft(request): aircraft = Aircraft.objects.all() favorited_aircraft_ids = None if request.user.is_authenticated(): favorited_aircraft_ids = list(FavoritedAircraft.objects.filter(user__id=request.user.id).values_list('id', flat=True)) print (favorited_aircraft_ids) return render(request, 'aircraft/aircraft_list.html', { 'aircraft': aircraft, 'favorited_aircraft_ids': favorited_aircraft_ids, }) Model.py
class Aircraft(AircraftModelBase): manufacturer = SortableForeignKey(Manufacturer) aircraft_type = SortableForeignKey(AircraftType) body = SortableForeignKey(Body) engines = models.PositiveSmallIntegerField(default=1) image = models.ImageField(upload_to="uploads/aircraft", blank=True, null=True) cost = models.DecimalField(max_digits=8, decimal_places=3) maximum_range = models.PositiveSmallIntegerField() passengers = models.PositiveSmallIntegerField() maximum_altitude = models.PositiveIntegerField() cruising_speed = models.PositiveIntegerField() fuel_capacity = models.DecimalField(max_digits=6, decimal_places=2) description = models.TextField() wing_span = models.PositiveSmallIntegerField(default=1) length = models.PositiveSmallIntegerField(default=1)