Pydev autogen DJANGO_SETTINGS_MODULE environment variable?

I am using Eclipse 3.7.2 and Pydev 2.6 to develop a Django program. When I upgrade Django from 1.3 to 1.4.1, I find a question about the DJANGO_SETTINGS_MODULE environment variable. When I run manage.py in the console, "DJANGO_SETTINGS_MODULE" is first None, and through

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")

will get the value correctly.

But when I run the code in PyDev, the environment "folder_name.settings" is set in front of the program. Even if the program does not have Django. And I can not find a way to change the value.

How to set a value outside my program?

Thank.

+5
source share
2 answers

The corresponding value for DJANGO_SETTINGS_MODULEcan be set via the Eclipse interface:

Properties

PyDev - Django. . , PyDev, -, "" .

+2

, Django 1.3 Django 1.4, DJANGO_SETTINGS_MODULE, . , DJANGO_SETTINGS_MODULE , .

:

export DJANGO_SETTINGS_MODULE=folder_name.settings

Django (, runserver). mod_wsgi, :

import os

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

. Django.

0

All Articles