Ubuntu运行Django时出现错误:You have unapplied migrations; your app may not work properly until they are applied.怎么处理?

Ubuntu运行Django时出现错误:You have unapplied migrations; your app may not work properly until they are applied.怎么处理?

Ubuntu运行Django时出现错误:You have unapplied migrations; your app may not work properly until they are applied.怎么处理?

解答:

python manage.py runserver

You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.

# 此时需要先输入以下命令
python manage.py migrate
# 输出以下信息则为正常情况
Operations to perform:
  Apply all migrations: admin, contenttypes, auth, sessions
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying sessions.0001_initial... OK
# 运行成功后,再次运行如下命令即可:
python manage.py runserver
# 此时出现如下结果则代表一切正常:
System check identified no issues (0 silenced).
December 21, 2014 - 08:56:00
Django version 1.7.1, using settings 'my_blog.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
# 如果你的环境中有图形化的浏览器的话,则可以进行进一步的检验。输入:http://127.0.0.1:8000/ 则会有相应的页面出现。第一步django已经踏出。
ckhero

发表评论

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax