Use Django's ImageField on App Engine / Python

Use Django's ImageField on App Engine / Python

When adding an image upload function, If you use the ImageField that comes with Django, It's convenient because it processes whether the image is appropriate, It doesn't work because App Engine doesn't have PIL. Actually using ImageField no module named image An error like this will occur and both development and production will fail.

Behind the chiller: When I first saw this page, I misunderstood that PIL can be used on App Engine, so it took a long time to solve it. In fact, App Engine doesn't allow PIL, and instead exposes an API for images. The correct answer is to include a PIL to emulate this API on your App Engine server for development.

I've always been skeptical about how to install PIL.

Introduction of dummy PIL

Django's framework can't be tampered with with genuine App Engine, so I thought I had to write the process myself, I googled and found a solution.

Image uploads working with models.ImageField on django-nonrel/appengine w/ django-fileuploads - ZONE – UYSRC Developer Blog

The PIL features that Django uses The solution is to create a dummy wrapped in the App Engine API. Now you can use ImageField without messing with Django's core.

How to use

PIL/ The source is above. Create a folder called PIL in the root of your App Engine application and Create the above there and you're ready to go. After that, you can use ImageField like normal Django.

Recommended Posts

Use Django's ImageField on App Engine / Python
How to use Django on Google App Engine / Python
Use ndb.tasklet on Google App Engine
[Python] Run Flask on Google App Engine
Use external modules on Google App Engine
Tweet (API 1.1) on Google App Engine for Python
Use matplotlib on Ubuntu 12 & Python
PIL with Python on Windows 8 (for Google App Engine)
Use Python on Windows (PyCharm)
Sakura Use Python on the Internet
Django's ImageField
Run Cloud Dataflow (Python) from App Engine
Memorandum on how to use gremlin python
Use without installing python 2.x on Windows
Install python on xserver to use pip
Python on Windows
twitter on python3
Vienna with Python + Flask web app on Jenkins
How to use Python Kivy ④ ~ Execution on Android ~
python on mac
My thoughts on python2.6 command line app template
Build Python3 + flask environment on GCP Compute Engine
Python on Windbg
Until you use PhantomJS with Python on Heroku
Use the LibreOffice app in Python (3) Add library
(Beginner) Basic usage of Datastore on Google App Engine
Getting Started with Google App Engine for Python & PHP
SPA learning sample (Angular2 + Bootstrap / App Engine / Python + webapp2)
Ubuntu 20.04 on raspberry pi 4 with OpenCV and use with python
Runtime version of Google App Engine / Python Standard Environment
Beginners use Python for web scraping (4) --2 Scraping on Cloud Shell
Use thingsspeak from python
Python conda on cygwin
Install python on WSL
Use config.ini in Python
PyOpenGL setup on Python 3
[Python] Use JSON with Python
Use fluentd from python
Install Python on Pidora.
Install Scrapy on python3
Use Valgrind in Python
Use MySQL from Python
Use mecab with Python3
Install Python on Mac
Use LiquidTap Python Client ③
Installing pandas on python2.6
Use Python 3.8 with Anaconda
Do you have any recommendations for a commentary book on Google App Engine / Python development?
python basic on windows ②
Install python on windows
Use python with docker
Use LiquidTap Python Client ②
Jinja2 | Python template engine
Install Python 2.7.3 on CentOS 5.4
Use BigQuery from python.
Use profiler in Python
Use Ansible on Windows
build Python on Ubuntu
Install Python 3.3 on Ubuntu 12.04
Install Python 3.4 on Mac
Use QuTiP on Windows