[Django] #21482: Can not collectstatic with symlink option in Windows Vista (and Windows 7 and 8) platform

11 views
Skip to first unread message

Django

unread,
Nov 21, 2013, 10:47:33 AM11/21/13
to django-...@googlegroups.com
#21482: Can not collectstatic with symlink option in Windows Vista (and Windows 7
and 8) platform
-------------------------------------+---------------------
Reporter: vajrasky | Owner: nobody
Type: New feature | Status: new
Component: contrib.staticfiles | Version: master
Severity: Normal | Keywords: windows
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+---------------------
In Windows Vista,

C:\SuperSecretProject>python manage.py collectstatic -l
.....
Symlinking is not supported by this platform (Windows)

But I am an '''administrator'''. I have the power to create symlink.

http://en.wikipedia.org/wiki/NTFS_symbolic_link
http://en.wikipedia.org/wiki/Symbolic_link

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

Django

unread,
Nov 21, 2013, 10:51:23 AM11/21/13
to django-...@googlegroups.com
#21482: Can not collectstatic with symlink option in Windows Vista (and Windows 7
and 8) platform
-------------------------------------+-------------------------------------
Reporter: vajrasky | Owner: vajrasky
Type: New feature | Status: assigned
Component: contrib.staticfiles | Version: master
Severity: Normal | Resolution:
Keywords: windows | Triage Stage:
Has patch: 1 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by vajrasky):

* status: new => assigned
* needs_better_patch: => 0
* needs_tests: => 0
* owner: nobody => vajrasky
* needs_docs: => 0
* has_patch: 0 => 1


Comment:

PR to uplift this restriction: https://github.com/django/django/pull/1956

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

Django

unread,
Nov 29, 2013, 10:05:53 AM11/29/13
to django-...@googlegroups.com
#21482: Can not collectstatic with symlink option in Windows Vista (and Windows 7
and 8) platform
-------------------------------------+-------------------------------------
Reporter: vajrasky | Owner: vajrasky
Type: New feature | Status: assigned
Component: contrib.staticfiles | Version: master

Severity: Normal | Resolution:
Keywords: windows | Triage Stage:
Has patch: 1 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 1
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by apollo13):

* needs_better_patch: 0 => 1


Comment:

The current checks in the PR aren't enough, if you are on python 2.x and
run collectstatic on Vista with `-l` it will fail. Basically symlinking on
windows is only supported on windows vista (and above) + admin account +
python3.

Also can you clarify on the administrator bits, do you effectively log in
as administrator or will every symlink call ask you if you want to allow
it?

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

Django

unread,
Nov 30, 2013, 9:17:17 AM11/30/13
to django-...@googlegroups.com
#21482: Can not collectstatic with symlink option in Windows Vista (and Windows 7
and 8) platform
-------------------------------------+-------------------------------------
Reporter: vajrasky | Owner: vajrasky
Type: New feature | Status: assigned
Component: contrib.staticfiles | Version: master

Severity: Normal | Resolution:
Keywords: windows | Triage Stage:
Has patch: 1 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 1
| UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by vajrasky):

In Windows Vista, to be able to create symlink, I need to right click the
Command Line menu, then click "Run as Administrator". Without this, when I
create symlink through os.symlink, I will get error that I don't have
enough privileges.

Oh, yeah, I forgot that prior Python 3.2, os does not provide symlink in
Windows. Sorry about that.

In Windows XP, you could have the ability to create symlink, but you must
install third-party driver. According to Python core developers, they are
against giving this feature to Windows XP in Python stdlib.
http://bugs.python.org/issue19792

So here is the updated PR. https://github.com/django/django/pull/2011

Windows XP -> no symlink
Python 2.7 in Windows Vista -> no symlink
Python 3.3 in Windows Vista -> symlink (of course you must have
administrator privilege)

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

Django

unread,
Nov 30, 2013, 9:17:44 AM11/30/13
to django-...@googlegroups.com
#21482: Can not collectstatic with symlink option in Windows Vista (and Windows 7
and 8) platform
-------------------------------------+-------------------------------------
Reporter: vajrasky | Owner: vajrasky
Type: New feature | Status: assigned
Component: contrib.staticfiles | Version: master

Severity: Normal | Resolution:
Keywords: windows | Triage Stage:
Has patch: 1 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by vajrasky):

* needs_better_patch: 1 => 0


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

Django

unread,
Nov 30, 2013, 9:19:39 AM11/30/13
to django-...@googlegroups.com
#21482: Can not collectstatic with symlink option in Windows Vista (and Windows 7
and 8) platform
-------------------------------------+-------------------------------------
Reporter: vajrasky | Owner: vajrasky
Type: New feature | Status: assigned
Component: contrib.staticfiles | Version: master

Severity: Normal | Resolution:
Keywords: windows | Triage Stage:
Has patch: 1 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by vajrasky):

It is possible to give symlink support in Python 2.x in Windows. But that
requires ctypes and win api.
http://stackoverflow.com/questions/6260149/os-symlink-support-in-windows

But I think I would upset a lot of people in Django if I did that.

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

Django

unread,
Dec 2, 2013, 5:26:26 AM12/2/13
to django-...@googlegroups.com
#21482: Can not collectstatic with symlink option in Windows Vista (and Windows 7
and 8) platform
-------------------------------------+-------------------------------------
Reporter: vajrasky | Owner: vajrasky
Type: New feature | Status: assigned
Component: contrib.staticfiles | Version: master

Severity: Normal | Resolution:
Keywords: windows | Triage Stage:
Has patch: 1 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by aaugustin):

I'm accepting the idea in general.

However the feature detection code in the current patch looks messy to me
(~30 lines) and hard to get right.

I'd find it more pythonic to create the symlink and provide a suitable
error message if that fails. Ask for forgiveness rather than permission :)

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

Django

unread,
Dec 2, 2013, 5:26:57 AM12/2/13
to django-...@googlegroups.com
#21482: Can not collectstatic with symlink option in Windows Vista (and Windows 7
and 8) platform
-------------------------------------+------------------------------------

Reporter: vajrasky | Owner: vajrasky
Type: New feature | Status: assigned
Component: contrib.staticfiles | Version: master
Severity: Normal | Resolution:
Keywords: windows | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by aaugustin):

* needs_better_patch: 0 => 1

* stage: Unreviewed => Accepted
* easy: 1 => 0
* needs_docs: 0 => 1


Comment:

Please add a line in the 1.7 release notes too!

--
Ticket URL: <https://code.djangoproject.com/ticket/21482#comment:7>

Django

unread,
Dec 7, 2013, 9:40:51 AM12/7/13
to django-...@googlegroups.com
#21482: Can not collectstatic with symlink option in Windows Vista (and Windows 7
and 8) platform
-------------------------------------+------------------------------------
Reporter: vajrasky | Owner: vajrasky
Type: New feature | Status: assigned
Component: contrib.staticfiles | Version: master

Severity: Normal | Resolution:
Keywords: windows | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* cc: sky.kok@… (added)
* needs_better_patch: 1 => 0
* needs_docs: 1 => 0


Comment:

Okay, I have updated the PR based on your request. Thanks!

https://github.com/django/django/pull/2011

--
Ticket URL: <https://code.djangoproject.com/ticket/21482#comment:8>

Django

unread,
Feb 9, 2014, 7:39:43 AM2/9/14
to django-...@googlegroups.com
#21482: Can not collectstatic with symlink option in Windows Vista (and Windows 7
and 8) platform
-------------------------------------+------------------------------------
Reporter: vajrasky | Owner: vajrasky
Type: New feature | Status: closed
Component: contrib.staticfiles | Version: master
Severity: Normal | Resolution: fixed

Keywords: windows | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by Jannis Leidel <jannis@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"5cc0555603167c7532b7b714e2672687da8f106e"]:
{{{
#!CommitTicketReference repository=""
revision="5cc0555603167c7532b7b714e2672687da8f106e"
Fixed #21482 -- Uplifted restriction of collectstatic using symlink option
in Windows NT 6.

Original patch by Vajrasky Kok. Reviewed by Florian Apolloner, Aymeric
Augustin.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21482#comment:9>

Django

unread,
Jun 23, 2014, 7:29:09 AM6/23/14
to django-...@googlegroups.com
#21482: Can not collectstatic with symlink option in Windows Vista (and Windows 7
and 8) platform
-------------------------------------+------------------------------------
Reporter: vajrasky | Owner: vajrasky
Type: New feature | Status: closed
Component: contrib.staticfiles | Version: master

Severity: Normal | Resolution: fixed
Keywords: windows | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------

Comment (by Claude Paroz <claude@…>):

In [changeset:"18b3788401e823266a560b12000697da04490beb"]:
{{{
#!CommitTicketReference repository=""
revision="18b3788401e823266a560b12000697da04490beb"
Cleaned temp dir in symlinks_supported()

Refs #21482.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21482#comment:10>

Django

unread,
Jun 23, 2014, 7:30:02 AM6/23/14
to django-...@googlegroups.com
#21482: Can not collectstatic with symlink option in Windows Vista (and Windows 7
and 8) platform
-------------------------------------+------------------------------------
Reporter: vajrasky | Owner: vajrasky
Type: New feature | Status: closed
Component: contrib.staticfiles | Version: master

Severity: Normal | Resolution: fixed
Keywords: windows | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------

Comment (by Claude Paroz <claude@…>):

In [changeset:"a90f0e605e9a7c1b30ccdca222ee2a0e7a78043b"]:
{{{
#!CommitTicketReference repository=""
revision="a90f0e605e9a7c1b30ccdca222ee2a0e7a78043b"
[1.7.x] Cleaned temp dir in symlinks_supported()

Refs #21482.
Backport of 18b3788401 from master.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21482#comment:11>

Reply all
Reply to author
Forward
0 new messages