Hi,

I saved with pickle an object created from a Django model :

class Country(models.Model):
    code = models.IntegerField(primary_key=True)
    name = models.CharField(max_length=30)
    def __str__(self):
        return (self.name)

england = Country(code=1, name="England")
pickle.dump(england, open( "england.p", "wb" ))

And I'm trying to access it outside Django, directly with Python :
england = pickle.load(open( "england.p", "rb" ))

But if fails :
ImproperlyConfigured: You must either define the environment variable 
DJANGO_SETTINGS_MODULE or call settings.configure() before accessing 
settings

My question is : how can i read this object (and access to its attributes) 
with Python without Django ?

Thanks for your help,
Matthieu

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ec42d8bc-cecf-4583-b808-6832fa30706b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to