Running a django python file in terminal
I have a Python file thats part of the Django framework called facade.py
from django.conf import settings
from .gateway import Gateway
class Facade(object):
def __init__(self):
self.gateway = Gateway(
settings.password,
settings.username,
)
I want to test this code in my terminal window. This is what I have tried:
within virutal-env
python
>>> from my.apps.app.facade import Facade
>>> object = Facade()
but this give me the error ImportError: Settings cannot be imported,
because environment variable DJANGO_SETTINGS_MODULE is undefined.
Why?
No comments:
Post a Comment