Forums

Can't see posts in Django

I finished DjangoGirls tutorial. All is working great on localhost, but after deploy to pythonanywhere posts are not visible. What I was trying:

  • current code deployed to repo and website reload
  • test post added via admin page directly on pythonanywhere
  • I see post when I run Post.objects.all() in pythonanywhere via Django console

I've checked settings and can't see anything wrong. I suppose something wasn't pushed to git repository, but my .gitignore was the same as the one in DjangoGirls tutorial.

Where should I looking for a bug?

I can't see any suspicious errors in logs as well.

Your posts are in the database. The default is to exclude the database from git so that you do not overwrite your production data with test data. If you want to transfer your posts, then you need to copy your database to PythonAnywhere.

Ok, I figure it out. Thanks!

How can i copy my database in production?

You can use django dumpdata and loadata See https://docs.djangoproject.com/en/4.0/ref/django-admin/#dumpdata