Re: from django.utils.six.moves import range, ImportError: cannot import name 'range'

2017-09-04 Thread Melvyn Sopacua
Is it possible you create your virtual environments
with global site-packages?
>From what I'm seeing this is caused primarily by
version mismatches of the six library and using
OS site-packages with virtualenv would certainly
do it as setuptools and pip both use six.

The difference with 1.10/1.11 I cannot explain
though.


On Mon, Sep 4, 2017 at 9:03 PM, Derek Zeng  wrote:
> Hi Melvyn,
>
> Renaming MIDDELWARE_CLASSES doesn't help either.
>
> These are the requirements I have:
>
> django==1.10.5
> djangorestframework
> markdown
> django-filter
> django-jinja
> pytest
> factory_boy
>
> fabric3
> pytest-django
>
> feedparser==5.2.1
> pytz
> PyYAML
> lxml
> requests
>
> django-extensions
> Werkzeug
>
> django-cors-headers
> psycopg2
> django_compressor
> django-libsass
> livereload
>
> ---
>
> I tried to comment out the code you quoted. But that has no effects.
>
>
> On Mon, Sep 4, 2017 at 12:37 PM, Melvyn Sopacua 
> wrote:
>>
>> Rename MIDDLEWARE_CLASSES to
>> MIDDLEWARE in settings to see if that changes anything.
>> If not, remove one by one (except static). There are some changes to
>> the static files middleware [1], but I can't really relate that to
>> your error.
>>
>> Is there anything in your project requirements that also uses six?
>>
>> There's no diff between 1.10.x and 1.11.x on six.py, but this code
>> looks like a possible root cause:
>>
>> # Here's some real nastiness: Another "instance" of the six module might
>> # be floating around. Therefore, we can't use isinstance() to check for
>> # the six meta path importer, since the other six instance will have
>> # inserted an importer with different class.
>> if (type(importer).__name__ == "_SixMetaPathImporter" and
>> importer.name == __name__):
>> del sys.meta_path[i]
>> break
>>
>> [1]
>> https://docs.djangoproject.com/en/1.11/releases/1.11/#django-contrib-staticfiles
>>
>> On Mon, Sep 4, 2017 at 3:32 PM, Derek Zeng  wrote:
>> > If I turn off debug mode, it gives me 500 error and showing the same
>> > stack
>> > trace in the console.
>> >
>> > I also tried 1.11.4, still the same error.
>> >
>> > On Mon, Sep 4, 2017 at 2:33 AM, Raffaele Salmaso 
>> > wrote:
>> >>
>> >> On Sun, Sep 3, 2017 at 4:26 PM, Derek Zeng  wrote:
>> >>>
>> >>> When I use django==1.10.7, this does not happen.
>> >>> When I use django==1.11a1 this happens.
>> >>
>> >> Why 1.11a1? Current is 1.11.4
>> >>
>> >> --
>> >> | Raffaele Salmaso
>> >> | https://salmaso.org
>> >> | https://bitbucket.org/rsalmaso
>> >> | https://github.com/rsalmaso
>> >>
>> >> --
>> >> You received this message because you are subscribed to a topic in the
>> >> Google Groups "Django users" group.
>> >> To unsubscribe from this topic, visit
>> >> https://groups.google.com/d/topic/django-users/49blpAjNxYc/unsubscribe.
>> >> To unsubscribe from this group and all its topics, send an email to
>> >> django-users+unsubscr...@googlegroups.com.
>> >> To post to this group, send email to django-users@googlegroups.com.
>> >> Visit this group at https://groups.google.com/group/django-users.
>> >> To view this discussion on the web visit
>> >>
>> >> https://groups.google.com/d/msgid/django-users/CABgH4Js1z0e7yypGD4f7z_eKbMrYWQEMT9viCSCshA1ROhMA_A%40mail.gmail.com.
>> >>
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Django users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to django-users+unsubscr...@googlegroups.com.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/django-users/CAAzyz%2BG2MjxRv001kjq%3DpkpzReVAHw03Jv9FW6Ry7sHPwKMsSQ%40mail.gmail.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Melvyn Sopacua
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/49blpAjNxYc/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2Bgw1GV3fMt5w4wUjOSviZzkdaHRU%2BFj4fHJqRSJnMGpcdLUNA%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email t

Re: from django.utils.six.moves import range, ImportError: cannot import name 'range'

2017-09-04 Thread Derek Zeng
Hi Melvyn,

Renaming MIDDELWARE_CLASSES doesn't help either.

These are the requirements I have:

django==1.10.5
djangorestframework
markdown
django-filter
django-jinja
pytest
factory_boy

fabric3
pytest-django

feedparser==5.2.1
pytz
PyYAML
lxml
requests

django-extensions
Werkzeug

django-cors-headers
psycopg2
django_compressor
django-libsass
livereload

---

I tried to comment out the code you quoted. But that has no effects.


On Mon, Sep 4, 2017 at 12:37 PM, Melvyn Sopacua 
wrote:

> Rename MIDDLEWARE_CLASSES to
> MIDDLEWARE in settings to see if that changes anything.
> If not, remove one by one (except static). There are some changes to
> the static files middleware [1], but I can't really relate that to
> your error.
>
> Is there anything in your project requirements that also uses six?
>
> There's no diff between 1.10.x and 1.11.x on six.py, but this code
> looks like a possible root cause:
>
> # Here's some real nastiness: Another "instance" of the six module might
> # be floating around. Therefore, we can't use isinstance() to check for
> # the six meta path importer, since the other six instance will have
> # inserted an importer with different class.
> if (type(importer).__name__ == "_SixMetaPathImporter" and
> importer.name == __name__):
> del sys.meta_path[i]
> break
>
> [1] https://docs.djangoproject.com/en/1.11/releases/1.11/#
> django-contrib-staticfiles
>
> On Mon, Sep 4, 2017 at 3:32 PM, Derek Zeng  wrote:
> > If I turn off debug mode, it gives me 500 error and showing the same
> stack
> > trace in the console.
> >
> > I also tried 1.11.4, still the same error.
> >
> > On Mon, Sep 4, 2017 at 2:33 AM, Raffaele Salmaso 
> > wrote:
> >>
> >> On Sun, Sep 3, 2017 at 4:26 PM, Derek Zeng  wrote:
> >>>
> >>> When I use django==1.10.7, this does not happen.
> >>> When I use django==1.11a1 this happens.
> >>
> >> Why 1.11a1? Current is 1.11.4
> >>
> >> --
> >> | Raffaele Salmaso
> >> | https://salmaso.org
> >> | https://bitbucket.org/rsalmaso
> >> | https://github.com/rsalmaso
> >>
> >> --
> >> You received this message because you are subscribed to a topic in the
> >> Google Groups "Django users" group.
> >> To unsubscribe from this topic, visit
> >> https://groups.google.com/d/topic/django-users/49blpAjNxYc/unsubscribe.
> >> To unsubscribe from this group and all its topics, send an email to
> >> django-users+unsubscr...@googlegroups.com.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> Visit this group at https://groups.google.com/group/django-users.
> >> To view this discussion on the web visit
> >> https://groups.google.com/d/msgid/django-users/CABgH4Js1z0e7yypGD4f7z_
> eKbMrYWQEMT9viCSCshA1ROhMA_A%40mail.gmail.com.
> >>
> >> For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at https://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/django-users/CAAzyz%2BG2MjxRv001kjq%
> 3DpkpzReVAHw03Jv9FW6Ry7sHPwKMsSQ%40mail.gmail.com.
> >
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Melvyn Sopacua
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/49blpAjNxYc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CA%2Bgw1GV3fMt5w4wUjOSviZzkdaHRU%
> 2BFj4fHJqRSJnMGpcdLUNA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAzyz%2BEiQYvTZO41n9QsFiZ_%3DxgH3Hkrsu%2BZ6erX7CO74VKNEw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: from django.utils.six.moves import range, ImportError: cannot import name 'range'

2017-09-04 Thread Melvyn Sopacua
Rename MIDDLEWARE_CLASSES to
MIDDLEWARE in settings to see if that changes anything.
If not, remove one by one (except static). There are some changes to
the static files middleware [1], but I can't really relate that to
your error.

Is there anything in your project requirements that also uses six?

There's no diff between 1.10.x and 1.11.x on six.py, but this code
looks like a possible root cause:

# Here's some real nastiness: Another "instance" of the six module might
# be floating around. Therefore, we can't use isinstance() to check for
# the six meta path importer, since the other six instance will have
# inserted an importer with different class.
if (type(importer).__name__ == "_SixMetaPathImporter" and
importer.name == __name__):
del sys.meta_path[i]
break

[1] 
https://docs.djangoproject.com/en/1.11/releases/1.11/#django-contrib-staticfiles

On Mon, Sep 4, 2017 at 3:32 PM, Derek Zeng  wrote:
> If I turn off debug mode, it gives me 500 error and showing the same stack
> trace in the console.
>
> I also tried 1.11.4, still the same error.
>
> On Mon, Sep 4, 2017 at 2:33 AM, Raffaele Salmaso 
> wrote:
>>
>> On Sun, Sep 3, 2017 at 4:26 PM, Derek Zeng  wrote:
>>>
>>> When I use django==1.10.7, this does not happen.
>>> When I use django==1.11a1 this happens.
>>
>> Why 1.11a1? Current is 1.11.4
>>
>> --
>> | Raffaele Salmaso
>> | https://salmaso.org
>> | https://bitbucket.org/rsalmaso
>> | https://github.com/rsalmaso
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/49blpAjNxYc/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CABgH4Js1z0e7yypGD4f7z_eKbMrYWQEMT9viCSCshA1ROhMA_A%40mail.gmail.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAzyz%2BG2MjxRv001kjq%3DpkpzReVAHw03Jv9FW6Ry7sHPwKMsSQ%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Bgw1GV3fMt5w4wUjOSviZzkdaHRU%2BFj4fHJqRSJnMGpcdLUNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: from django.utils.six.moves import range, ImportError: cannot import name 'range'

2017-09-04 Thread Derek Zeng
If I turn off debug mode, it gives me 500 error and showing the same stack
trace in the console.

I also tried 1.11.4, still the same error.

On Mon, Sep 4, 2017 at 2:33 AM, Raffaele Salmaso 
wrote:

> On Sun, Sep 3, 2017 at 4:26 PM, Derek Zeng  wrote:
>>
>> When I use django==1.10.7, this does not happen.
>> When I use django==1.11a1 this happens.
>>
> Why 1.11a1? Current is 1.11.4
>
> --
> | Raffaele Salmaso
> | https://salmaso.org
> | https://bitbucket.org/rsalmaso
> | https://github.com/rsalmaso
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/49blpAjNxYc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CABgH4Js1z0e7yypGD4f7z_eKbMrYWQEMT9viCSCshA1ROhMA_A%
> 40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAzyz%2BG2MjxRv001kjq%3DpkpzReVAHw03Jv9FW6Ry7sHPwKMsSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: from django.utils.six.moves import range, ImportError: cannot import name 'range'

2017-09-03 Thread Raffaele Salmaso
On Sun, Sep 3, 2017 at 4:26 PM, Derek Zeng  wrote:
>
> When I use django==1.10.7, this does not happen.
> When I use django==1.11a1 this happens.
>
Why 1.11a1? Current is 1.11.4

-- 
| Raffaele Salmaso
| https://salmaso.org
| https://bitbucket.org/rsalmaso
| https://github.com/rsalmaso

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABgH4Js1z0e7yypGD4f7z_eKbMrYWQEMT9viCSCshA1ROhMA_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: from django.utils.six.moves import range, ImportError: cannot import name 'range'

2017-09-03 Thread Melvyn Sopacua
Could you turn off DEBUG and check what the problem is then?
The reason is that I want to make sure we're not judging the side
effect of *rendering* the exception.

On Sun, Sep 3, 2017 at 11:52 PM, Derek Zeng  wrote:
> it's the same in either versions of python. the output was captured when i
> was just debugging it in 3.5.
>
> On Sun, Sep 3, 2017 at 2:55 PM, James Schneider 
> wrote:
>>
>>
>>
>>   File
>> "/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/contrib/staticfiles/storage.py",
>> line 21, in 
>> from django.utils.six.moves import range
>> ImportError: cannot import name 'range'
>>
>>
>> Are you sure you're using 3.6.2? Do you have another virtualenv with 3.5
>> and no Django installed?
>>
>> -James
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/49blpAjNxYc/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciV4vpt7Vk%3D8GDS_wNQHqhsuwA5vcfakWo%3DoVjQziXLdxA%40mail.gmail.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAzyz%2BG0MTUNd8xm8ajNby38eoi7Xmj6RgXBZwp2WfAS-n9s2g%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Bgw1GWxFhcKwAe%2B-cwJq9A6N0m-tcyS7N4%3D%3D0Uai1RrG%2Be%3Dpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: from django.utils.six.moves import range, ImportError: cannot import name 'range'

2017-09-03 Thread Derek Zeng
it's the same in either versions of python. the output was captured when i
was just debugging it in 3.5.

On Sun, Sep 3, 2017 at 2:55 PM, James Schneider 
wrote:

>
>
>   File 
> "/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/contrib/staticfiles/storage.py",
>  line 21, in 
> from django.utils.six.moves import range
> ImportError: cannot import name 'range'
>
>
> Are you sure you're using 3.6.2? Do you have another virtualenv with 3.5
> and no Django installed?
>
> -James
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/49blpAjNxYc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CA%2Be%2BciV4vpt7Vk%3D8GDS_wNQHqhsuwA5vcfakWo%
> 3DoVjQziXLdxA%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAzyz%2BG0MTUNd8xm8ajNby38eoi7Xmj6RgXBZwp2WfAS-n9s2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: from django.utils.six.moves import range, ImportError: cannot import name 'range'

2017-09-03 Thread James Schneider
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/contrib/staticfiles/storage.py",
line 21, in 
from django.utils.six.moves import range
ImportError: cannot import name 'range'


Are you sure you're using 3.6.2? Do you have another virtualenv with 3.5
and no Django installed?

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciV4vpt7Vk%3D8GDS_wNQHqhsuwA5vcfakWo%3DoVjQziXLdxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: from django.utils.six.moves import range, ImportError: cannot import name 'range'

2017-09-03 Thread Derek Zeng
It is a project I developed in ubuntu and currently running on a ubuntu 
server. I just bought a new mac mini, so I would like to develop on mac.

I have isolated the problem to the django version.
 
When I use django==1.10.7, this does not happen.
When I use django==1.11a1 this happens. 

This is the full stack trace:

Traceback (most recent call last):
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/contrib/staticfiles/handlers.py",
 line 63, in __call__
return self.application(environ, start_response)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/core/handlers/wsgi.py",
 line 157, in __call__
response = self.get_response(request)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/core/handlers/base.py",
 line 124, in get_response
response = self._middleware_chain(request)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/core/handlers/exception.py",
 line 43, in inner
response = response_for_exception(request, exc)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/core/handlers/exception.py",
 line 93, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), 
sys.exc_info())
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/core/handlers/exception.py",
 line 139, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django_extensions/management/technical_response.py",
 line 6, in null_technical_500_response
six.reraise(exc_type, exc_value, tb)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/six.py", 
line 686, in reraise
raise value
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/core/handlers/exception.py",
 line 41, in inner
response = get_response(request)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/core/handlers/base.py",
 line 249, in _legacy_get_response
response = self._get_response(request)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/core/handlers/base.py",
 line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/core/handlers/base.py",
 line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/coderek/Documents/projects/mysite/mysite/urls.py", line 78, in 
home
return render(req, 'index.html', {'posts': posts})
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/shortcuts.py",
 line 30, in render
content = loader.render_to_string(template_name, context, request, 
using=using)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/template/loader.py",
 line 68, in render_to_string
return template.render(context, request)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/template/backends/django.py",
 line 66, in render
return self.template.render(context)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/template/base.py",
 line 207, in render
return self._render(context)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/template/base.py",
 line 199, in _render
return self.nodelist.render(context)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/template/base.py",
 line 990, in render
bit = node.render_annotated(context)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/template/base.py",
 line 957, in render_annotated
return self.render(context)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/template/loader_tags.py",
 line 177, in render
return compiled_parent._render(context)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/template/base.py",
 line 199, in _render
return self.nodelist.render(context)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/template/base.py",
 line 990, in render
bit = node.render_annotated(context)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/template/base.py",
 line 957, in render_annotated
return self.render(context)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/compressor/templatetags/compress.py",
 line 131, in render
return self.render_compressed(context, self.kind, self.mode, forced=forced)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/compressor/templatetags/compress.

Re: from django.utils.six.moves import range, ImportError: cannot import name 'range'

2017-09-02 Thread James Schneider
On Sep 2, 2017 11:17 PM, "Derek Zeng"  wrote:

Hi,

Today I tried to install my django project on a new mac computer. I used
virutalenv to setup the packages.

After I start the app by running './mange.py runserver' and access the home
page I got the error

from django.utils.six.moves import range, ImportError: cannot import name
> 'range'


Really not sure why it has this weird error. I'm using python 3.6.2

Any help is appreciated!


Is the referenced error coming from code that you wrote?

There's a comma at the end of the import line, which may cause that error.

Also make sure that you've installed Django within your virtualenv. If it
is, then also make sure you have six installed (although Django should have
done that already).

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXBx28t5kOo4FdSarW-h4O44UO%3D2JoO-00yd_6o%3DLhPxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.