
Python问题
「已注销」
分享价值,记录点滴!
展开
-
pycharm django 再建一个app
在pycharm的工具栏找到 Tools,点击之后会有“Run manage.py task”选项,点击它之后,在pycharm下面会出现一个输入界面,在里面输入“startapp appName(你的App名称)”,回车之后就可以在工程下面看到你新建的App了。参考:http://www.oschina.net/question/2849805_2205006?_t_t_t=原创 2017-03-26 18:42:07 · 11413 阅读 · 2 评论 -
Django框架models使用group by的方法
Django框架models使用group by的方法:首先,看下列代码:UserData.objects.filter(hubid=sensorid,time__range=(time2,time1)).values('hour').annotate(sum_out=Sum('outdoor'), sum_in=Sum('indoor'), sum_eat=Sum('kitchen'转载 2017-03-22 20:21:26 · 16926 阅读 · 0 评论 -
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.的解决办法
如题,这个错误的解决办法如下: 在代码文件的最上方添加以下代码:import os,djangoos.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_name.settings")django.setup()参考:http://blog.youkuaiyun.com/tianweitao/article/details/502363转载 2017-03-22 20:20:25 · 8048 阅读 · 0 评论 -
django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE的解决办法
在Python的开发中,遇到了这个错误: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANG转载 2017-03-22 20:18:54 · 12038 阅读 · 2 评论 -
Please enter the correct username and password for a staff account. Note tha
Please enter the correct username and password for a staff account. Note tha解决:5. 清空数据库1python manage.py flush此命令会询问是 yes 还是 no, 选择 yes 会把数据全部清空掉,只留下空表。原创 2017-03-17 22:08:16 · 8049 阅读 · 0 评论 -
python错误 unicodedecodeerror ascii codec can’t decode byte 0xd7 in position 9 ordinal not in range(12
解决unicodedecodeerror ascii codec can’t decode byte 0xd7 in position 9 ordinal not in range(128)在Windows平台下,安装python模块时,报如下错误:UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in转载 2016-12-05 16:03:20 · 1258 阅读 · 0 评论 -
“Unicode Error ”unicodeescape" codec can't decode bytes… Cannot open text files in Python 3
python 中 r 表示不转义(1)以r或R开头的python中的字符串表示(非转义的)原始字符串python里面的字符,如果开头处有个r,比如:(r’^time/plus/\d{1,2}/$’, hours_ahead)说明字符串r"XXX"中的XXX是普通字符。有普通字符相比,其他相对特殊的字符,其中可能包含转义字符,即那些,反斜杠加上对应字母,表原创 2016-11-19 18:17:51 · 2312 阅读 · 0 评论