[Django] #20027: manage.py shebang should reflect used python executable

17 views
Skip to first unread message

Django

unread,
Mar 12, 2013, 3:45:15 AM3/12/13
to django-...@googlegroups.com
#20027: manage.py shebang should reflect used python executable
----------------------------+--------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: new
Component: Python 3 | Version: 1.5
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------
Hi,
since Django now supports both Python 2 and Python 3, it seems that
shebang in generated manage.py in new projects should reflect this.
Currently, manage.py always points to "python", but IMHO when generated
with python3, it should point to "python3". I think it makes sense to
manage a project with python version that was used to generate it.

--
Ticket URL: <https://code.djangoproject.com/ticket/20027>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 12, 2013, 4:28:54 AM3/12/13
to django-...@googlegroups.com
#20027: manage.py shebang should reflect used python executable
---------------------------+--------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: closed

Component: Python 3 | Version: 1.5
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------+--------------------------------------
Changes (by aaugustin):

* status: new => closed
* needs_better_patch: => 0
* resolution: => wontfix
* needs_tests: => 0
* needs_docs: => 0


Comment:

There isn't any guarantee that the executables for Python 2 and 3 are
called python and python3. They may just as well be called python2 and
python.

--
Ticket URL: <https://code.djangoproject.com/ticket/20027#comment:1>

Django

unread,
Mar 12, 2013, 4:44:29 AM3/12/13
to django-...@googlegroups.com
#20027: manage.py shebang should reflect used python executable
---------------------------+--------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: closed

Component: Python 3 | Version: 1.5
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------+--------------------------------------

Comment (by anonymous):

Right, so what about using the name of the binary that was used? As in
sys.executable.

--
Ticket URL: <https://code.djangoproject.com/ticket/20027#comment:2>

Django

unread,
Mar 12, 2013, 5:21:44 AM3/12/13
to django-...@googlegroups.com
#20027: manage.py shebang should reflect used python executable
---------------------------+--------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: closed

Component: Python 3 | Version: 1.5
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------+--------------------------------------

Comment (by aaugustin):

If you're going to share the code — either because it's open source, or
with co-workers — this could still be a problem. (Rewriting sheebangs
always causes trouble.)

The recommended way to deal with this is to create a virtualenv with the
Python binary you want, and to activate it whenever your work on your
Django project.

--
Ticket URL: <https://code.djangoproject.com/ticket/20027#comment:3>

Django

unread,
Apr 6, 2016, 11:49:45 AM4/6/16
to django-...@googlegroups.com
#20027: manage.py shebang should reflect used python executable
---------------------------+--------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: closed

Component: Python 3 | Version: 1.5
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------+--------------------------------------

Comment (by rhertzog):

What about rewriting it at least when "python" does not exist on the PATH?

When I wrote a test suite for the Debian package, I tested specifically in
a Python3 only environment (and in Debian, much like most sane distros,
Python 3 is /usr/bin/python3) and I was astonished that django-admin
createproject would not create a working ./manage.py...

--
Ticket URL: <https://code.djangoproject.com/ticket/20027#comment:4>

Django

unread,
Apr 7, 2016, 5:44:46 PM4/7/16
to django-...@googlegroups.com
#20027: manage.py shebang should reflect used python executable
---------------------------+--------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: closed

Component: Python 3 | Version: 1.5
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------+--------------------------------------

Comment (by collinanderson):

I expect this will become more of an issue soon when people start using
Ubuntu 16.04, which doesn't have /usr/bin/python installed by default. It
basically means Django won't work outside of a virtualenv unless you
manually change manage.py.

os.path.basename(sys.executable) seems reasonable to me.

Or, we could hard code it as python3 and and tell people to change it by
hand if they really want to start a new project using python 2. :)

Or just wait til January when we remove py2 support anyway.

--
Ticket URL: <https://code.djangoproject.com/ticket/20027#comment:5>

Django

unread,
Nov 24, 2017, 6:56:58 PM11/24/17
to django-...@googlegroups.com
#20027: manage.py shebang should reflect used python executable
---------------------------+--------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: closed

Component: Python 3 | Version: 1.5
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------+--------------------------------------

Comment (by bhch):

setuptools automatically replaces the shebang line with the interpreter
being used. For example, if you install Django in a virtualenv, the
shebang gets re-written from this - `#!/usr/bin/env python` to this -
`#!/path/to/venv/bin/python`. So why hardcode the shebang when all works
perfectly anyway?

--
Ticket URL: <https://code.djangoproject.com/ticket/20027#comment:6>

Reply all
Reply to author
Forward
0 new messages