Forums

It doesn't show post created in local/admin

I am using Django and I don't know why the post that I've just created in http://127.0.0.1:8000/admin/ and that I can see in local aren't available online. Of course I did deploy and it went well (I can see a new css layout). I am new so I'd also like to know where are posts created saved. I attach the code that is displayed and that one that isn't.

This is showed:

{% load staticfiles %}
<html>
    <head>
        <title>Grecipsum</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>
        <body>
    <div class="page-header">
        <h1><a href="/">Splash Greco</a></h1>
    </div>
    <div class="content container">
        <div class="row">
            <div class="col-md-8">
            {% block content %}
            {% endblock %}
            </div>
        </div>
    </div>
</body>
    </body>
</html>

While this isn't:

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

{% block content %}
    <div class="post">
        {% if post.published_date %}
            <div class="date">
                {{ post.published_date }}
            </div>
        {% endif %}
        <h1>{{ post.title }}</h1>
        <p>{{ post.text|linebreaksbr }}</p>
    </div>
{% endblock %}

If you do something locally, it's in the local database. Unless you do something to transfer the database to PythonAnywhere, your local database is going to be different to the one on PythonAnywhere.

Hello there, I am having exactly the same problem, I think the problem comes from the static_root variable which is (in my case) wrong.

When looking at the dev tools report I found:

GET http://user.pythonanywhere.com/static/css/blog.css 404 (Not Found)

I'm figuring out how to say to pythonanywhere to go take the css files in the right place authomatically, since the command

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

in settings.py is not working weell.

See http://help.pythonanywhere.com/pages/DjangoStaticFiles/ for details about how to setup static files for Django.