Re: Problems receiving data from DB (sqlite3)
Al 03/04/13 19:38, En/na Johannes ha escrit:
> Hi list,
> I have a confusing behaviour when I try to access some data in the DB.
> I created a model and build the database with syncdb.
> I can create and save data via python manage.py shell and it's still
> available after I a restart of the shell.
> But this data is not visible from the testserver. Even more, If I create
> and save data from the testserver, it's only available until I restart
> the server.
Sounds like you're using two DBs ... does not make much sense since I'd
expect you're using the same settings.py in both cases, so the same
database. In the testserver it looks like an in memory database which is
destroyed upon restart.
Out of curiosity, what happens to the data created through the shell
after starting/stoping the testserver, it's still there?
In order to diagnose what the problem really is I'd suggest to add a
print to some of your views:
def your_view(request, ...):
from django.conf import settings
print "databases", settings.DATABASES
...
rest of your code
and in the shell just:
from django.conf import settings
print "databases", settings.DATABASES
Compare both outputs to make sure you're using the same database.
HTH
--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home