Harsha Reddy
unread,Jul 2, 2009, 3:25:00 AM7/2/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
I using Django from past one week.
On the Django web site, I read that it is a high-level python web
framework. Inspite of knowing this I am trying to use a Django
application both as a web application as well as a CLI client.
To know if this works out, I created a Django project named "pyMyApp"
and added an application into it.
I updated the:
settings.py to detect my application,
also models.py to create two tables.
I have an other python file in the application which parses XML. This
python file makes use of objects defined in the models.py to store the
parsed values in those 2 tables.
In the directory "../" where my "pyMyApp" resides, I created a file
index.py added the code to test the parser code. Runnning this file
yeilds:
python index.py
Traceback (most recent call last):
File "index.py", line 3, in ?
from pyAPP.translator.translate import *
File "/usr/src/pySCAF/translator/translate.py", line 3, in ?
from pySCAF.translator.models import duo, scenario
File "/usr/src/pySCAF/../pySCAF/translator/models.py", line 1, in ?
from django.db import models
File "/usr/lib/python2.4/site-packages/django/db/__init__.py", line
10, in ?
if not settings.DATABASE_ENGINE:
File "/usr/lib/python2.4/site-packages/django/utils/functional.py",
line 269, in __getattr__
self._setup()
File "/usr/lib/python2.4/site-packages/django/conf/__init__.py",
line 38, 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.
By looking at the trace, I got a thought that "Django is designed to
be used as web framework"
if at all I want to use it both as cli and web apps, how to achieve
this in the case above?