Opened 5 years ago

Closed 5 years ago

#16616 closed Bug (worksforme)

startproject should use virtualenv compatible /usr/bin/env python hashbang for

Reported by: Odin Hørthe Omdal Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


Always after doing startproject test I need to change #!/usr/bin/python to #!/usr/bin/env python in order for it to work without problem with virtualenv.

Using #!/usr/bin/env python as a hashbang is a very common idiom in python, and I believe there shouldn't be any problems using that.

Change History (1)

comment:1 Changed 5 years ago by Aymeric Augustin

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: worksforme
Status: newclosed

I found only one instance of #!/usr/bin/python in the current source tree, and it's an example in the fastcgi docs:

./docs/howto/deployment/fastcgi.txt:    #!/usr/bin/python

All the other files use #!/usr/bin/env python, in particular project_template/ does:

./django/bin/!/usr/bin/env python
./django/bin/!/usr/bin/env python
./django/bin/profiling/!/usr/bin/env python
./django/bin/!/usr/bin/env python
./django/conf/project_template/!/usr/bin/env python
./django/contrib/admin/static/admin/js/!/usr/bin/env python
./extras/!/usr/bin/env python
./tests/!/usr/bin/env python

Either you're using an old version of Django where this problem existed, or your packaging / distribution tools change the hashbang.

Last edited 5 years ago by Aymeric Augustin (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top