搭建门户网站django报错

  1. 报错这个缘由是在配置路由url上
    urlpatterns 写成了 urlpattern
    格式如下:
    urlpatterns = [
    path('',home,name = 'home'), # 这里的逗号忘加了,很久没写了
    ]

django.core.exceptions.ImproperlyConfigured: The included URLconf 'main' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

加密签名

SECRET_KEY = '' 之前我的加密签名没写 不是这个缘由

记录个技巧:一个端口只能跑一个网页,本地端的话
这里的缘由是写错了字母
DJANGO_SETTINGS_MODULE我把它写成了DJANGO_SETTINS_MODULE # SETTINGS写成了SETTINS
这也是我之前注释时候写的,太不仔细了我,我把它复制下来,结果我出错了。

django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

r.readAsArrayBuffer(f);//readAsArrayBuffer作用是啥
原本是r.readAsDataURL(f);抄错了,太依赖idea的提示代码了

url:'/ocr/',
// 发送地址是ocr
url地址写错/ocr
导致Not Found: /ocr;地址后还要加/

5.(5,6缘由有可能想要去吃饭了,并且那时候也写了一下午,太累导致的把)

frommarry写错他显示白色,就代表他不是函数;fromarray才是 # frommarry这里多写了个m

COLOR_BAYER_BG2BGR写错这是编辑器快速提示时没看直接选的,cv2.COLOR_BGR2RGB这个才对

result.update('{"output:code"}') # ()内加了引号,字典外加引号,这错误哎;这里字典只要值加"",键不需要
这个才对
result.update({"output":code})

企业门户网站的搭建
报错
TypeError: 'module' object is not iterable

raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'newsApp.urls' from 'D:百度网盘企业版a_pacticeDjango_tets企业门户网站hengDaProject ewsAppurls.py'>' does not appear to have any patterns in it. If you see valid patterns in
the file then the issue is probably caused by a circular import.

原因是path('newsApp/',include('newsApp.urls')), # 这里忘家加了/
还有newsApp/urls.py中的 urlpattern写路由配置的忘记加s;原来变量名是 urlpatterns

找不到“newDetail”的反向项。““newDetail”不是有效的视图函数或模式名称。
Reverse for 'newDetail' not found. 'newDetail' is not a valid view function or pattern name.;path()函数中的第三个写错的话,逆向解析错误
path('newDetail/int:id/',views.newDetail,name='newDatail'), # 新闻详情页面 newDatail名字写错了 正确的是newDetail;把单词中的e写成了a

Could not parse the remainder: '% endblock %' from '% endblock %'
{{% endblock %}}写错了 多写了{};其实是 {% endblock %}

不显示图片,主页,和搜索页不显示,可详情页显示
本来的设计页面就没显示

下方是整个侧边导航栏样式毛病
/下面少些了个li;就变成了整个model-list的样式,在面在怎么修改都无用/
.model-list li{ /* 谷歌浏览器中的css样式变化很小,这时整个div很难看出来,看看具体的链接*/
text-align: center;
background-color: #f6f6f6;
font-size: 16px;
}

/* 文字段落 属性写错了,是定位到 p;而我写了span;这就是不理解Html文件布局,随意不仔细的抄/
.model-details span{
line-height:3px;
text-indent:2em;
text-align:justify;
text-justify:inter-ideograph;
/
color:#005197;这个好像使多余的*/

}

巨坑:
SQLite Database is Locked
不能频繁的处理数据,不然报错 Database is Locked

django2.0 执行makemigrations报错 There are some values Django cannot serialize into migration files.

default=timezone这里写错了;报错是Django 无法序列化:timezone是个模块而不是函数,正确的是default=timezone.now,

publishDate = models.DateTimeField(max_length=20,default=timezone,verbose_name='发布时间')

name 'FUZZY_WHOOSH_MAX_EDITS' is not defined查询报错;在新闻动态查询模块,查询报错 这个有可能是Whoosh指定的分词器是英文分词器,要将其替换成中文分词器
新闻详情页面视图也报错

部署在网站上一段时间,部分数据库的图片不显示,当然网站快过期了,明天0点过期

努力拼搏吧,不要害怕,不要去规划,不要迷茫。但你一定要在路上一直的走下去,尽管可能停滞不前,但也要走。
原文地址:https://www.cnblogs.com/wkhzwmr/p/15222658.html