小的前两天才入门Django
看着Django Girls的网站成功把example架了起来
最近参考
http://drumcoder.co.uk/blog/2010/jun/13/monthly-calendar-django/
这份范例想要把行事历加入页面中
但是在调整Models的时候似乎出现了问题
在 manage.py makemigrations的时候 似乎因为int 没有initial value
所以他请我输入
当时看他说明写 datetime 也就照着打下去
结果在更新的时候会出现
int() argument must be a string or a number, not 'datetime.datetime'
于是上网查询了一下
我修改了 0003 的migrate的资讯 把 datetime改为 default=0;
(也是唯一一个有看到datetime的migration file)
Server可以正常run 但执行首页会出现一样的问题
又google了一下把整个migration都清除
1. Erase every /migrations folder inside your apps
2. Go to the database and drop the **table name** table
(or delete its rows)
整个清除之后重新执行 python manage.py migrate
可以看到两张table有重新产生 可是执行首页依然出现
int() argument must be a string or a number, not 'datetime.datetime'
目前确定专案目录下资料夹 migrations 已经不存在
想请问是不是还有哪些地方有所遗漏
以下附上部分错误讯息与 model程式码
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.7.10
Exception Type: TypeError
Exception Value:
int() argument must be a string or a number, not 'datetime.datetime'
Exception Location: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/fields/__init__.py in get_prep_value, line 1601
Python Executable: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Python Version: 2.7.10
Python Path:
['/Users/kumashi/Desktop/share/django/mysite',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
'/Library/Python/2.7/site-packages']
Server time: Thu, 1 Oct 2015 11:06:05 +0000