When I run Django, I'm getting an error stating that DJANGO_SETTINGS_MODULE is undefined

71 views
Skip to first unread message

Alex Polvi

unread,
Apr 8, 2008, 3:28:15 AM4/8/08
to Google App Engine
Hi there,

I wish my first post to the list was contributing something ... but
sadly, I'm unable to even get django running as described here:

http://code.google.com/appengine/articles/django.html

I startapp'd using the SDK bundled django code, created the main.py
and app.yaml as described. Then I ran dev_appserver.py on the new app
directory (root of the django app). It raises an:

EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is
undefined.

The "Installing Django Development Version" portion of the doc seems
to spell out how to set up that var. However, once I run that it
throws on not knowing what log_version is.

main.py is a new script created to launch the django app -- and all
non-static traffic should be sent to it using app.yaml, correct? From
there, I can use the urls.py family to do all my django specific url
handling?

It is very possible I'm just not understanding where main.py is
supposed to be created/modified.

Thanks for your help. I was going to hack out a django app tonight,
then saw this was released, and hey -- how handy? :)

Regards,

-Alex

PS: my app is: http://16x16.appspot.com/

Seth Ladd

unread,
Apr 8, 2008, 4:40:28 AM4/8/08
to Google App Engine
Maybe looking in http://code.google.com/p/google-app-engine-samples/source/browse/trunk/django_example/?r=11
will help provide some clues?

On Apr 7, 9:28 pm, Alex Polvi <alexpo...@gmail.com> wrote:
> Hi there,
>
> I wish my first post to the list was contributing something ... but
> sadly, I'm unable to even getdjangorunning as described here:
>
> http://code.google.com/appengine/articles/django.html
>
> I startapp'd using the SDK bundleddjangocode, created the main.py
> and app.yaml as described. Then I ran dev_appserver.py on the new app
> directory (root of thedjangoapp). It raises an:
>
> EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is
> undefined.
>
> The "InstallingDjangoDevelopment Version" portion of the doc seems
> to spell out how to set up that var. However, once I run that it
> throws on not knowing what log_version is.
>
> main.py is a new script created to launch thedjangoapp -- and all
> non-static traffic should be sent to it using app.yaml, correct? From
> there, I can use the urls.py family to do all mydjangospecific url
> handling?
>
> It is very possible I'm just not understanding where main.py is
> supposed to be created/modified.
>
> Thanks for your help. I was going to hack out adjangoapp tonight,

shabda raaj

unread,
Apr 8, 2008, 4:43:37 AM4/8/08
to Google App Engine
http://www.b-list.org/weblog/2007/sep/22/standalone-django-scripts/

Setup the settings to use

from django.core.management import setup_environ
from mysite import settings

setup_environ(settings)

before a call to


# Force Django to reload its settings.
from django.conf import settings
settings._target = None

On Apr 8, 1:40 pm, Seth <sethl...@gmail.com> wrote:
> Maybe looking inhttp://code.google.com/p/google-app-engine-samples/source/browse/trun...

Alex Polvi

unread,
Apr 8, 2008, 11:44:52 AM4/8/08
to Google App Engine
Seth,

Thank you so much! That example (django_bootstrap.py and settings.py)
did the trick.


As a suggestion to the google folks, might be helpful for newbs to
briefly explain what the main.py script it. It sounds like it is a
script that is created by django, not by the developer. Next, I was
not able to use the main.py presented in the tutorial -- had to use
this one instead:

http://code.google.com/p/google-app-engine-samples/source/browse/trunk/django_example/django_bootstrap.py?r=11

Might be worth updating.

Thanks again for your help! I'm excited to get hacking.

Regards,

-Alex

On Apr 8, 1:40 am, Seth <sethl...@gmail.com> wrote:
> Maybe looking inhttp://code.google.com/p/google-app-engine-samples/source/browse/trun...
Reply all
Reply to author
Forward
0 new messages