Apps deployed on Heroku do not reflect on a part of programme although they can work on local server

Jesse Hirata Source

This application was developed through Djangogirls tutorial (https://tutorial.djangogirls.org/en/django_forms/).
I would like to know how to find out the reason and fix them. I dont get why those kinds of problems happens as the blow pictures show.


The local server: Everything does work correctly and I just would like to make this work on heroku
enter image description here

Apps deployed on Heroku: Any post does not show up although I think that I push correctly files on heroku
enter image description here


What I already did was here:
1) restart heroku and relaunch apps
2) clear cache of chrome and reload apps
3) check git log
4) commit and push again (git push heroku master)

What should I do next ?
See how data migration is working but I do not know how to check ...

ーーUPDATE 20180314
I do not think that the code has something wrong because it correctly works on local server.

Data (=posts) come from posgresql on heroku while local server uses sqlite3.The data is stored on database by translating into SQL over migration files which is kind of intermediate files.

The below tree is the structure of this application.

blog
├── __init__.py
├── __pycache__
│   ├── __init__.cpython-36.pyc
│   ├── admin.cpython-36.pyc
│   ├── forms.cpython-36.pyc
│   ├── models.cpython-36.pyc
│   ├── urls.cpython-36.pyc
│   └── views.cpython-36.pyc
├── admin.py
├── apps.py
├── forms.py
├── migrations
│   ├── 0001_initial.py
│   ├── __init__.py
│   └── __pycache__
│       ├── 0001_initial.cpython-36.pyc
│       └── __init__.cpython-36.pyc
├── models.py
├── templates
│   └── blog
│       ├── base.html
│       ├── post_detail.html
│       ├── post_edit.html
│       └── post_list.html
├── tests.py
├── urls.py
└── views.py


The source files on the above pics might be relevant to the two below files. (1) base.html (2) post_list.html

(1) base.html

{% load staticfiles %}
<html>
    <head>
        <title>Django Girls blog</title>
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
        <link href='//fonts.googleapis.com/css?family=Lobster&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="{% static 'css/blog.css' %}">
    </head>
    <body>
    <div class="page-header">
<a href="{% url 'post_new' %}" class="top-menu"><span class="glyphicon glyphicon-plus"></span></a>
        <h1><a href="/">Django Girls Blog</a></h1>
    </div>
    <div class="content container">
        <div class="row">
            <div class="col-md-8">
            {% block content %}
            {% endblock %}
            </div>
        </div>
    </div>
    </body>
</html>


(2) post_list.html

{% extends 'blog/base.html' %}

{% block content %}
    {% for post in posts %}
        <div class="post">
            <div class="date">
                {{ post.published_date }}
            </div>
            <h1><a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a></h1>
            <p>{{ post.text|linebreaks }}</p>
        </div>
    {% endfor %}
{% endblock content %}

ーーUPDATE20180315
I checked the differences between data in local server and heroku.
The data seems to be different somehow but Im not sure of how to resolve it.

1) local server

>>> from blog.models import Post
>>> Post.objects.all()
<QuerySet [<Post: Sample title>, <Post: Sample title1>, <Post: Sample title2>, <Post: Sample title3>]>
>>> 


2) heroku

djgpractice::DATABASE=> select*from blog_post;
-[ RECORD 1 ]--+------------------------------
id             | 1
title          | test
text           | test
created_date   | 2018-03-13 15:04:57+00
published_date | 
author_id      | 1
-[ RECORD 2 ]--+------------------------------
id             | 2
title          | test
text           | test
created_date   | 2018-03-13 15:22:31.942797+00
published_date | 
author_id      | 1
-[ RECORD 3 ]--+------------------------------
id             | 3
title          | test
text           | test
created_date   | 2018-03-13 15:54:34.933753+00
published_date | 
author_id      | 1


This is the database list on heroku

djgpractice::DATABASE-> \d
                           List of relations
 Schema |               Name                |   Type   |     Owner      
--------+-----------------------------------+----------+----------------
 public | auth_group                        | table    | tcdjrkyztekdbd
 public | auth_group_id_seq                 | sequence | tcdjrkyztekdbd
 public | auth_group_permissions            | table    | tcdjrkyztekdbd
 public | auth_group_permissions_id_seq     | sequence | tcdjrkyztekdbd
 public | auth_permission                   | table    | tcdjrkyztekdbd
 public | auth_permission_id_seq            | sequence | tcdjrkyztekdbd
 public | auth_user                         | table    | tcdjrkyztekdbd
 public | auth_user_groups                  | table    | tcdjrkyztekdbd
 public | auth_user_groups_id_seq           | sequence | tcdjrkyztekdbd
 public | auth_user_id_seq                  | sequence | tcdjrkyztekdbd
 public | auth_user_user_permissions        | table    | tcdjrkyztekdbd
 public | auth_user_user_permissions_id_seq | sequence | tcdjrkyztekdbd
 public | blog_post                         | table    | tcdjrkyztekdbd
 public | blog_post_id_seq                  | sequence | tcdjrkyztekdbd
 public | django_admin_log                  | table    | tcdjrkyztekdbd
 public | django_admin_log_id_seq           | sequence | tcdjrkyztekdbd
 public | django_content_type               | table    | tcdjrkyztekdbd
 public | django_content_type_id_seq        | sequence | tcdjrkyztekdbd
 public | django_migrations                 | table    | tcdjrkyztekdbd
 public | django_migrations_id_seq          | sequence | tcdjrkyztekdbd
 public | django_session                    | table    | tcdjrkyztekdbd
(21 rows)
pythondjangogitheroku

Answers

comments powered by Disqus