0

I'm learning programming (beginner level), and am currently working on a web app project in Python/Django. I would like to add an image field to my models, but the tutorials I find don't seem to work. Does anyone have simple, comprehensive steps to do it?

I have run into the following problems:

  1. Conflicting PIL vs Pillow imports (I have deleted the PIL imports for now; I have Pillow installed, but not sure if I need to do anything else with it?)

  2. When I try to make a migration I get: 'NameError: name 'os' is not defined', which relates to my settings.py file, and which I'm not sure how to resolve.

Thank you!

pol_v
  • 1
  • Welcome to SO! People could help you better if you post your code. If `os` is not defined, that often indicates, that you forgot an `import os`; maybe at the top of your `settings.py`? – nehalem Feb 07 '22 at 16:09
  • have you imported os in your setting files perhaps add the line { import os } on top of your settings.py file – Neetesshhr Feb 07 '22 at 16:26
  • I'll try importing os! Thank you, will post how I get on. I'm very new to all this >_ – pol_v Feb 07 '22 at 16:37
  • 1. having pillow installed is all you need for now to get the field to work. 2. as others mentioned; "import os" at the beginning of the file is most likely your fix. – Cerealz Feb 07 '22 at 18:16
  • Thanks you for the suggestions everyone! I put is aside yesterday but will give another go this week, hopefully Pillow and os will help solve the problem. – pol_v Feb 08 '22 at 19:33

0 Answers0