django开发bug记录

  1. 错误信息
    Non-ASCII character '\xe6'
    解决方法:
    文件头加入
#coding:utf-8
  1. 错误信息
    raise AppRegistryNotReady("Models aren't loaded yet.")

    解决方法:
    安装djanog-registration-redux

    pip install django-registration-redux -i http://pypi.douban.com/simple
    1. 错误信息:

    页面错误:
    NoReverseMatch at /accounts/login/
    Reverse for 'auth_password_reset' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

后台错误:

/home/spang/.virtualenvs/env/local/lib/python2.7/site-packages/django/contrib/sites/models.py:78: RemovedInDjango19Warning: Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9.
  class Site(models.Model):

解决办法:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.sites',#添加这一行
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'project',
    'operation',
    'registration',
    'debug_toolbar',
)

如果出现以下问题,/admin无法访问,报
DoesNotExist at /admin/login/
Site matching query does not exist.
错误
解决办法:
application中的admin不要使用以下语句:

from django.contrib import admin
# from project.models import xiangmu

# admin.site.register(xiangmu)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值