4

I copied google cloud sample Django project for google appengine. Then, I modified settings.py for storing all static files on google storage. I added this settings

DEFAULT_FILE_STORAGE = 'storages.backends.gs.GSBotoStorage'
GS_ACCESS_KEY_ID = 'YourID'
GS_SECRET_ACCESS_KEY = 'YourKEY'
GS_BUCKET_NAME = 'YourBucket'
STATICFILES_STORAGE = 'storages.backends.gs.GSBotoStorage'

On local machine everything is working perfectly but when I deploy it to google appengine static file problem appears. Django can't find static files which in special google storage bucket. This is the error message:

ImportError at /admin/login/ cannot import name SpooledTemporaryFile

in app.yaml file, settings about static files:

handlers:
- url: /static
  static_dir: static/
- url: .*
  script: mysite.wsgi.application

I am new at google cloud and i can't figure it out where I am doing wrong.

Edit: I think, I must modify app.yaml file to say appengine "Hey, use another bucket don't serve static file yourself".

Tere is more detailed error output:

ImportError at /admin/ cannot import name SpooledTemporaryFile Request Method: GET Request URL: https://sbminteractive.appspot.com/admin/ Django Version: 1.8 Exception Type: ImportError Exception Value: cannot import name SpooledTemporaryFile Exception Location: /base/data/home/apps/e~sbminteractive/20170414t175601.400554512166425273/lib/storages/backends/s3boto.py in , line 6 Python Executable: /base/data/home/runtimes/python27/python27_dist/python Python Version: 2.7.5 Python Path: ['/base/data/home/apps/e~sbminteractive/20170414t175601.400554512166425273', '/base/data/home/apps/e~sbminteractive/20170414t175601.400554512166425273/lib', '/base/data/home/runtimes/python27/python27_dist/lib/python27.zip', '/base/data/home/runtimes/python27/python27_dist/lib/python2.7', '/base/data/home/runtimes/python27/python27_dist/lib/python2.7/plat-linux2', '/base/data/home/runtimes/python27/python27_dist/lib/python2.7/lib-tk', '/base/data/home/runtimes/python27/python27_dist/lib/python2.7/lib-old', '/base/data/home/runtimes/python27/python27_dist/lib/python2.7/lib-dynload', '/base/data/home/runtimes/python27/python27_dist/lib/python2.7/site-packages', '/base/data/home/runtimes/python27/python27_lib/versions/1', '/base/data/home/runtimes/python27/python27_lib/versions/third_party/MySQLdb-1.2.5', '/base/data/home/runtimes/python27/python27_lib/versions/third_party/protorpc-1.0', '/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3', '/base/data/home/runtimes/python27/python27_lib/versions/third_party/webob-1.1.1', '/base/data/home/runtimes/python27/python27_lib/versions/third_party/yaml-3.10'] Server time: Fri, 14 Apr 2017 14:57:51 +0000

  • google docs has prepared for professionals. You can try heroku or amazon AWS. You can find tons of video or documentation. Do not waste your time with google. – mustafa kemal tuna Jan 21 '19 at 20:09
  • Check this doc: https://cloud.google.com/python/django/flexible-environment Open mysite/settings.py for editing. Set the value of STATIC_URL to the following URL. Replace with the bucket name you created earlier. – Vit Amin Mar 13 '20 at 08:35

0 Answers0