0

good morning,

I have a problem with a django app deployed as a web app on Microsoft Azure.

Basically after adding an imageField to a model, when from administration I enter in the modification of one of those objects (related to that model) I get the following error:

No module named 'backend'

Request Method: GET Request URL: http://......myurl...../adminforsuperuser/auth/tenants/tenant/4791c751-bc04-4bb5-aa9f-82732b7c3217/change/ Django Version: 2.2.8 Exception Type: ModuleNotFoundError Exception Value:

No module named 'backend'

Exception Location: in _find_and_load_unlocked, line 953 Python Executable: /opt/python/3.6.12/bin/python3.6 Python Version: 3.6.12 Python Path:

['/opt/python/3.6.12/bin', '/tmp/8d942cfe6a508ea', '/tmp/8d942cfe6a508ea/antenv3.6/lib/python3.6/site-packages', '/opt/python/3.6.12/lib/python36.zip', '/opt/python/3.6.12/lib/python3.6', '/opt/python/3.6.12/lib/python3.6/lib-dynload', '/opt/python/3.6.12/lib/python3.6/site-packages']

Server time: Fri, 9 Jul 2021 12:04:19 +0000

More details about the error: image

The field I add to the model:

logo= models.ImageField(upload_to=path_and_rename, default='tenant_logos/default_logo.png')

Practically the fact that in edit must also show me the form to change the image (and the path of the image currently saved in that object) breaks the whole page.

The strange thing is that it works locally! They, local and prod, have the same apps installed:

INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.admin', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'crispy_forms', .....my app here... , ]

Thank you!

1 Answers1

0

I think there should be {{ field.url }} as we can to see in docs Django https://docs.djangoproject.com/en/3.2/faq/usage/#how-do-i-use-image-and-file-fields

kot6egemot
  • 36
  • 3
  • Thanks you for answer, however the template of the image (where there is the error: "fields.fields", is not on my folder, It is a piece of code imported (Admin stuff, I think). However the strage think is that all work LOCALLY.. – A lot of bugs Jul 09 '21 at 12:52
  • i suggest it's solution https://stackoverflow.com/questions/16307307/django-admin-show-image-from-imagefield – kot6egemot Jul 09 '21 at 13:07
  • This solution only explain how to show Image insteAd of url link on admin. My problem is that the django: fieldset.html , fail to show the IMageField – A lot of bugs Jul 12 '21 at 11:59
  • my app crash before it show the url or image of the field – A lot of bugs Jul 12 '21 at 12:05