import re
from BeautifulSoup import BeautifulSoup
import urllib2
from os import environ
#from settings import *
def myfunction() :
environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings"
from settings import *
I get an error:
myscript.py:22: SyntaxWarning: import * only allowed at module level.
I have tried placing "from settings import *" above the "def
myfunction()", then I get an error:
raise EnvironmentError, "Could not import settings '%s' (Is it on
sys.path?
Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
EnvironmentError: Could not import settings 'mysite.settings' (Is it
on sys.path
? Does it have syntax errors?): No module named mysite.settings
If I don't do import *, what do I need to import in order to use
django model in a python script?
Import only the followings:
DATABASE_ENGINE
DATABASE_NAME
DATABASE_USER
DATABASE_PASSWORD
DATABASE_HOST
DATABASE_PORT ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---