我开始学习Django,但是当我尝试启动我的本地服务器时,这不起作用。当我给出“runserver”命令时,我收到此错误,希望有人可以帮我解决这个问题。我使用Windows 8.1,我的python版本是3.4.2和django 1.8
C:\Users\RA\projects\projects django\mysite>python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line
338, in execute_from_command_line
utility.execute()
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line
330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python34\lib\site-packages\django\core\management\base.py", line 393,
in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Python34\lib\site-packages\django\core\management\commands\runserver.
py", line 49, in execute
super(Command, self).execute(*args, **options)
File "C:\Python34\lib\site-packages\django\core\management\base.py", line 444,
in execute
output = self.handle(*args, **options)
File "C:\Python34\lib\site-packages\django\core\management\commands\runserver.
py", line 88, in handle
self.run(**options)
File "C:\Python34\lib\site-packages\django\core\management\commands\runserver.
py", line 97, in run
autoreload.main(self.inner_run, None, options)
File "C:\Python34\lib\site-packages\django\utils\autoreload.py", line 325, in
main
reloader(wrapped_main_func, args, kwargs)
File "C:\Python34\lib\site-packages\django\utils\autoreload.py", line 296, in
python_reloader
exit_code = restart_with_reloader()
File "C:\Python34\lib\site-packages\django\utils\autoreload.py", line 282, in
restart_with_reloader
exit_code = os.spawnve(os.P_WAIT, sys.executable, args, new_environ)
UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: inval
id character
我尝试使用add in autoreload.py
new_environ['PATH'] =os.path.abspath(new_environ['PATH'].replace('\u202a', ''))
离开文件
def restart_with_reloader():
while True:
args = [sys.executable] + ['-W%s' % o for o in sys.warnoptions] + sys.argv
if sys.platform == "win32":
args = ['"%s"' % arg for arg in args]
new_environ = os.environ.copy()
new_environ["RUN_MAIN"] = 'true'
new_environ['PATH'] =os.path.abspath(new_environ['PATH'].replace('\u202a', ''))
exit_code = os.spawnve(os.P_WAIT, sys.executable, args, new_environ)
if exit_code != 3:
return exit_code
但我的问题没有解决,我开始使用django和python,这是我第一次使用django,请帮帮我!