使用django报错问题(python manage.py startapp app-name)
2018-01-15 19:33
459 查看
报错信息
1.python manage.py startapp app-name出错可能是你的数据库配置有错,默认sqllite,下面将其改为mysql
2.编码错误
在所有初始文件开头都加上
Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "G:\Python27\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line utility.execute() File "G:\Python27\lib\site-packages\django\core\management\__init__.py", line 330, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "G:\Python27\lib\site-packages\django\core\management\base.py", line 402, in run_from_argv connections.close_all() File "G:\Python27\lib\site-packages\django\db\utils.py", line 263, in close_all connection.close() File "G:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py", line 225, in close if not self.is_in_memory_db(self.settings_dict['NAME']): File "G:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py", line 302, in is_in_memory_db return name == ":memory:" or "mode=memory" in force_text(name) File "G:\Python27\lib\site-packages\django\utils\encoding.py", line 102, in force_text raise DjangoUnicodeDecodeError(s, *e.args) django.utils.encoding.DjangoUnicodeDecodeError: 'utf8' codec can't decode byte 0xbb in position 3: invalid start byte. You passed in 'G:\\\xbb\xf9\xb4\xa1\xcf\ xee\xc4\xbf\\Py_Project\\Django\\test1\\db.sqlite3' (<type 'str'>)
1.python manage.py startapp app-name出错可能是你的数据库配置有错,默认sqllite,下面将其改为mysql
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'test', #数据库名 'USER': 'root', #数据库用户名 'PASSWORD': '', #数据库密码 'HOST': '127.0.0.1', 'PORT': '3306', } }
2.编码错误
G:\基础项目\Py_Project\Django\test1>python manage.py startapp booktest Traceback (most recent call last): File "manage.py", line 10, in <module&g c277 t; execute_from_command_line(sys.argv) File "G:\Python27\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line utility.execute() File "G:\Python27\lib\site-packages\django\core\management\__init__.py", line 303, in execute settings.INSTALLED_APPS File "G:\Python27\lib\site-packages\django\conf\__init__.py", line 48, in __getattr__ self._setup(name) File "G:\Python27\lib\site-packages\django\conf\__init__.py", line 44, in _setup self._wrapped = Settings(settings_module) File "G:\Python27\lib\site-packages\django\conf\__init__.py", line 92, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "G:\Python27\lib\importlib\__init__.py", line 37, in import_module __import__(name) File "G:\基础项目\Py_Project\Django\test1\test1\settings.py", line 80 SyntaxError: Non-ASCII character '\xe6' in file G:\基础项目\Py_Project\Django\test1\test1\settings.py on line 80, but no encoding declared; see http://python.o rg/dev/peps/pep-0263/ for details
在所有初始文件开头都加上
#coding:utf-8
相关文章推荐
- Django学习(1)——python manage.py startapp app-name新建app报错问题
- 关于python django-admin.py startproject mysite不工作的问题
- django 运行python manage.py sqlall books 时报错 app has migration
- 玩django时运行python manage.py runserver时遇到问题
- Django执行python manage.py syncdb时,出行No module named MySQLdb问题解决方法
- Python[问题处理] django-admin.py startproject learning_log .
- django使用python manage.py syncdb注意事项
- 在使用django框架搭建web中如果需要单独运行py脚本出现AppRegistryNotReady("Apps aren't loaded yet.")问题
- 使用python搭建Django应用程序步骤及版本冲突问题解决
- 详解Python的Django框架中manage命令的使用与扩展
- python+Django django-admin.py startproject mysite不生效
- Python Django的使用:Writing your first Django app--实践
- fastdfs python客户端fdfs_client_py使用问题
- python manage.py syncdb Unknown command: 'syncdb'问题解决方法
- SVN在windows上使用check-case-insensitive.py遇到的问题(Python2.5,svn1.5.4)
- 详解Python的Django框架中manage命令的使用与扩展
- Python安装PyGraphics包 (使用media模块)问题
- Django学习之manage.py使用
- 关于python中将py文件转换成exe文件的问题(使用py2exe)