﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31716	django-admin runserver mostly does not work on Windows	Christian Ullrich	Tom Forbes	"I frequently encounter the problem that running ""django-admin runserver"" on Windows fails:

{{{
<some-venv>\scripts\python.exe: can't open file '<some-venv>\test\Scripts\django-admin': [Errno 2] No such file or directory
}}}

The command works if run with --noreload.

There are probably other conditions that must be met for it to fail, or work. I *think* it makes a difference, for example, if Django was installed with pip or setuptools. The .exe ""console scripts "" are different between the two; one type has a bit of readable Python at the end, the other does not.

What I do know is that the problem is either caused or enabled by the generated console scripts (the .exe wrappers in venv/Scripts) stripping the .exe extension from their own sys.argv[0] when passing that to Python to run. If I sabotage this by changing the regex in the file itself (where present), or by adding the extension again in utils/autoreload.py before running the command line, it works fine.

To be honest, I have no idea whether this is a bug in Django, or pip, or setuptools, or distutils, or something else entirely. I have spent the last two days trying to figure out what exactly goes wrong, and where, with little success. I'm reporting it here because Django is the only place I could find where it is possible to kludge the code into working. I'll be happy to take my business elsewhere if someone can point the way."	Bug	closed	Core (Management commands)	3.1	Normal	fixed	Windows	Tom Forbes	Ready for checkin	1	0	0	0	0	0
