Forums

Django deployment problem

Hi!

Can someone help me identify my problem please.

I'm trying to put my first project to pythonanywhere, but I have some deployment issues. I am using the Django For Girls tutorial : http://tutorial.djangogirls.org/en/django_templates/index.html.

And when do git pull, in the bash console, I can only see the HTML modifications on my website, but the python part doesn't work at all. For example if I try to do : <p> This modifcation works </p> I will see it in my website, but if I do something like :

{{ posts }}

I get this : [] on my live website. Even in the source code, I have [] this element.

I triple checked the paths, the Python version I use is the latest 3.4, Django is 1.9.

If you have any idea, I'd be more than thankful!

If I understand you correctly, the difference is that you have different databases on your local machine and on PythonAnywhere. This is completely normal -- people generally use different databases so that they can test stuff on their local machine (creating lots of posts with test data) while their live site has the posts that they want to share with the world.

So, you need to add some posts on the live site (using the admin interface, just like you did locally).

So the Django template tags known as {% %}, aren't recognized because of some database mismatch ?

Thank you again.

It's because there is nothing in the database on pythonanywhere, so when you do {{ posts }}, django templating doesn't put out anything.

ie. if you deleted rows from your local database, you would see the same effect locally.

Thank you for your answer, it's clear now.

Is there a way I can get through and make it work ?

Best Regards!

Go to the admin interface on the copy of your website that's running on PythonAnywhere, http://akasimov.pythonanywhere.com/admin, log in, and create a post -- just like you did on your local one.