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" ))
england = pickle.load(open( "england.p", "rb" ))
ImproperlyConfigured: You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings
Hello,
if you don't have to modify the object, I would suggest using serialization instead of pickling.
Best,
Gergely
--
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...@googlegroups.com.
To post to this group, send email to django...@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.
--
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...@googlegroups.com.
To post to this group, send email to django...@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/b260b072-3a28-4ef3-97a7-d419e401ca80%40googlegroups.com.