Django “Python Manage.py runserver” Error Fix!
Apr 23django 3.1 final was just released. So upgrading to the next version is always fun to test out new features.
After installing django 3.1 when you run:
python manage.py runserver
You might see this error:
Traceback (most recent call last):
File "manage.py", line 11, in
execute_manager(settings)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python 2.6/dist-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/commands /runserver.py", line 8, in
from django.core.handlers.wsgi import WSGIHandler
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 11, in
from django.core import signals
File "/usr/local/lib/python2.6/dist-packages/django/core/signals.py", line 1, in
from django.dispatch import Signal
File "/usr/local/lib/python2.6/dist-packages/django/dispatch/__init__.py", line 9, in
from django.dispatch.dispatcher import Signal, receiver
ImportError: cannot import name receiver
This is because you have installed more then one version of django.
To fix this Delete django (/usr/local/lib/python2.6/dist-packages/django) Just delete the whole folder. Now reinstall django again and your working!
Any questions please comment below!
Showing Korean in Python
Dec 31If you ever tried to add korean in your prints or what have you with python you will notice you get an error looking like this:
SyntaxError: Non-ASCII character ‘xec’ in file gravity.py on line 10, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
Luckily this is an extremely easy fix!
just add this to the top of your script:
# -*- coding: utf-8 -*-
example source with korean:
http://pastebin.com/eXWsxZM9
Enjoy and Happy New Years!
