您有3个未应用的迁移。在应用app(s)的迁移之前,您的项目可能无法正常运行:admin,auth

时间:2016-09-13 11:53:19

标签: python django pycharm

我刚刚创建了Django项目并运行了服务器。 它工作正常,但向我显示了像

这样的警告
python manage.py migrate

然后我跑了

?: (1_7.W001) MIDDLEWARE_CLASSES is not set.
    HINT: Django 1.7 changed the global defaults for the MIDDLEWARE_CLASSES.
django.contrib.sessions.middleware.SessionMiddleware, django.contrib.auth.middleware.AuthenticationMiddleware, and django.contrib.messages.middleware.MessageMiddleware were removed from the defaults. If your project needs these middleware then you should configure this setting.

在终端。它有效,但向我展示了这个

You have 3 unapplied migration(s). 
Your project may not work properly until you apply
the migrations for app(s): admin, auth.

现在我在启动服务器后收到此警告。

~$ python3.5 --version
Python 3.5.2

>>> django.VERSION
(1, 10, 1, 'final', 1)

那么如何正确迁移以消除此警告?

我正在使用PyCharm并尝试通过PyCharm和终端创建项目并遇到同样的问题。

<table id="listquestions" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
<thead>
    <tr>
        {% for key, answer in answers[0] %}
            <th>{{ key }}</th>
        {% endfor %}
    </tr>
</thead>
<tbody> 
    {% for key,answer in answers %}
        {% for field, value in answer %}
        <tr>
           {% if field == 'a_id' %}
            <td>{{ answer.a_id }}</td>
            {% else %}
            <td>
                <a class="listquestions" href="#" data-name="{{ field }}" data-type="text" data-pk="{{ answer.a_id }}" data-url="path_for('qa.edit')" data-title="enter attribute name">
                    {{ value }}
                </a>
            </td>
            {% endif %}
        </tr>
        {% endfor %}
    {% endfor %}
</tbody>
</table>

2 个答案:

答案 0 :(得分:8)

所以我的问题是我使用了错误的python版本进行迁移。

python3.5 manage.py migrate

解决了这个问题。

答案 1 :(得分:1)

你可能使用了错误的django版本。您需要django1.10