Reputation: 109
I have the "mysite/poll" app from the Django tutorial running locally and am trying to deploy to GAE. I have defined DJANGO_SETTINGS_MODULE in the wsgi.py and admin.py as
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
This is the traceback on deployment:
Traceback (most recent call last):
File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 196, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 255, in _LoadHandler
handler = __import__(path[0])
File "/base/data/home/apps/s~ceemee11111/1.365096182895980177/admin.py", line 1, in <module>
from django.contrib import admin
File "/python27_runtime/python27_lib/versions/third_party/django-1.4/django/contrib/admin/__init__.py", line 3, in <module>
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
File "/python27_runtime/python27_lib/versions/third_party/django-1.4/django/contrib/admin/helpers.py", line 2, in <module>
from django.contrib.admin.util import (flatten_fieldsets, lookup_field,
File "/python27_runtime/python27_lib/versions/third_party/django- 1.4/django/contrib/admin/util.py", line 1, in <module>
from django.db import models
File "/python27_runtime/python27_lib/versions/third_party/django-1.4/django/db/__init__.py", line 11, in <module>
if DEFAULT_DB_ALIAS not in settings.DATABASES:
File "/python27_runtime/python27_lib/versions/third_party/django-1.4/django/utils/functional.py", line 184, in inner
self._setup()
File "/python27_runtime/python27_lib/versions/third_party/django-1.4/django/conf/__init__.py", line 40, in _setup
raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
why is the DJANGO_SETTINGS_MODULE still undefined
Thanks Dan
Upvotes: 1
Views: 215
Reputation: 353
https://developers.google.com/appengine/docs/python/tools/libraries27#django
You can also try add
env_variables:
DJANGO_SETTINGS_MODULE: 'myapp.settings'
in app.yaml
Upvotes: 1
Reputation: 14213
Try this instead:
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
Upvotes: 1