Django
快乐虫
这个作者很懒,什么都没留下…
展开
-
ModuleNotFoundError: No module named ‘debug_toolbar‘ 解决办法
安装django-debug-toolbarpip3 install django-debug-toolbar原创 2020-10-04 23:21:58 · 2714 阅读 · 0 评论 -
ModuleNotFoundError: No module named ‘dal‘ 解决办法
解决办法:安装django-autocomplete-lightpip3 install django-autocomplete-light原创 2020-10-04 23:11:37 · 695 阅读 · 0 评论 -
TypeError: argument of type ‘PosixPath‘ is not iterable解决办法
File “/home/cdd/Desktop/Django/typeidea-env/lib/python3.8/site-packages/django/db/backends/sqlite3/creation.py”, line 13, in is_in_memory_dbreturn database_name == ‘:memory:’ or ‘mode=memory’ in database_nameTypeError: argument of type ‘PosixPath’ is not原创 2020-09-15 21:26:29 · 5352 阅读 · 4 评论 -
Django2.0 + Python3.8安装xadmin过程
最近学习用Django写博客,博客成形之后准备把后台管理admin转为xadmin,没想到有很多坑,耽误了好多时间,不过最后还是解决了,参考了很多网友的文章,今天来总结下。第一步:下载xadmin的源码直接去这里 https://github.com/sshwsfc/xadmin/tree/django2下载源码,将下载下来的xadmin-django2.zip文件解压后放到site-packages文件夹中,这个xadmin需要安装依赖,然后在该文件夹下执行安装命令:pip3 install req原创 2020-09-14 23:23:44 · 871 阅读 · 0 评论 -
owner = models.ForeignKey(User) TypeError: __init__() missing 1 required positional argument:
python编程从入门到实践第19章19.3.2将数据关联到用户models.py原文代码:owner = models.ForeignKey(User)执行django shell对话时出现如下错误:owner = models.ForeignKey(User)TypeError: init() missing 1 required positional argument: ‘on_delete’修改如下:owner = models.ForeignKey(User, on_delete原创 2020-07-23 11:14:40 · 489 阅读 · 0 评论 -
django.core.exceptions.ImproperlyConfigured: Specifying a namespace in include()
django.core.exceptions.ImproperlyConfigured: Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.原代码:原创 2020-07-23 01:14:46 · 809 阅读 · 0 评论 -
ImportError: cannot import name ‘login‘ from ‘django.contrib.auth.views‘
原代码:from django.conf.urls import urlfrom django.contrib.auth.views import loginfrom . import viewsurlpatterns = [ # 登录页面 url('login/', login, {'template_name': 'users/login.html'}, name='login'),]报错:ImportError: cannot import name ‘login’原创 2020-07-23 01:04:33 · 3402 阅读 · 0 评论 -
ModuleNotFoundError: No module named ‘django.core.urlresolvers‘
python入门到实践第19章19.1.1添加新主题视图函数问题原views.py导入from django.core.urlresolvers import reverse修改如下:from django.urls import reverse原创 2020-07-22 21:39:38 · 796 阅读 · 0 评论 -
django.core.exception.ImproperlyConfigured: Specifying a namespace in include() 解决办法
django.core.exceptions.ImproperlyConfigured: Passing a 3-tuple to include() is not supported. Pass a 2-tuple containing the list of patterns and app_name, and provide the namespace argument to include() instead.解决办法from django.contrib import adminfrom dj原创 2020-06-25 01:22:05 · 8314 阅读 · 6 评论