在测试数据库表创建过程时,打印如下信息:
[root@UHDATA008 mysite]# python manage.py sqlall books
CommandError: App 'books' has migrations. Only the sqlmigrate and sqlflush commands can be used when an app has migrations.
[root@UHDATA008 mysite]# python manage.py migrate
Operations to perform:
Apply all migrations: (none)
Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
解决方法:
python manage.py makemigrations
[root@UHDATA008 mysite]# python manage.py sqlall books
CommandError: App 'books' has migrations. Only the sqlmigrate and sqlflush commands can be used when an app has migrations.
[root@UHDATA008 mysite]# python manage.py migrate
Operations to perform:
Apply all migrations: (none)
Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
解决方法:
python manage.py makemigrations
python manage.py migrate
错误:
'str' object has no attribute 'resolve'
AttributeError at /hello/
'str' object has no attribute 'resolve'
Request Method: | GET |
---|---|
Request URL: | http://10.159.33.17:8080/hello/ |
Django Version: | 1.8.14 |
Exception Type: | AttributeError |
Exception Value: | 'str' object has no attribute 'resolve' |
Exception Location: | /usr/local/lib/python2.7/site-packages/Django-1.8.14-py2.7.egg/django/core/urlresolvers.py in resolve, line 367 |
Python Executable: | /usr/bin/python |
解决方法:
urlpatterns = patterns('',
('^hello/$', hello),
)