Re: Building a calculator

2018-03-21 Thread Derek Zeng
Basically what you need is to store current selections/values in the 
session https://docs.djangoproject.com/en/2.0/topics/http/sessions/
Then access the session in the view and redirect accordingly.

def my_

On Tuesday, March 20, 2018 at 4:29:00 PM UTC-4, Abbad yeslem wrote:
>
> Hello, 
>
> I am new to Django and trying to learn using the framework as best as i 
> can.
>
> I am trying to build an application that can calculate thickness for a 
> vessel under two cases: internal or external pressure. 
>
> I am really stuck trying to answer the following (Please Help):
>
> 1) How can i redirect the user to one of the two calculation pages (where 
> they will need to enter values in a field and see the result on the same 
> page) based on their choice from ModelChoiceField?
>
> 2) How to do the calculations based on the equations i have and the 
> iterations they require ( i know i should write them in the views but not 
> sure how exactly)?
>
> Please, if there is any other problem or you require further details on 
> what i am trying to achieve, do tell me.
>
> Thanks a lot!
>
> - The calculations i am trying to do through the web app ( for the case of 
> the external pressure)
> p = float(input("Enter pressure in Kpa "))
> if (p < 20684): # p < 3000 psi
> 
>   e = float(input("Enter joint efficiency "))
>   c = float(input("Enter corrosion allowance in mm "))
>   ltt = float(input("Enter tan-tan length in mm "))
>   do = float(input("Enter outside diameter in mm "))
>   t= float(input("Initialize thickness value in mm "))
>   step_size= float(input("Enter step side in mm "))
>   
> else: 
>   print("pressure too high!")
>   quit()
>   
> print("Select Material.")
> print("1.ASME SA285 C")
> print("2.ASME SA516")
> print("3.ASME SA537")
> print("4.Enter Material")
>
> choice = input("Enter choice(1/2/3):")
>
> #s=allowable stress
>
> if choice == '1':
> s=235000 
> el=206842718.79
>
> 
> if choice == '2':
> s=26 
> el=2
> 
> 
> if choice == '3':
> s=31 
> el=3
>
> 
> if choice == '4':
> s=int(input("Enter material allowable stress in Kpa "))
> el=int(input("Enter modulus of elasticity in Kpa "))
> 
>
> allowable_pressure=0
>
>
> while allowable_pressure < p:
> t=t+step_size
> 
> d=do-2*t
> 
> print("Select Head type.")
> print("1.hemi-heads")
> print("2.2:1 S.E. heads")
> print("3.100% - 6% heads")
>
> choice_1 = input("Enter choice(1/2/3):")
>
> if choice_1 == '1':
>   l=ltt + 0.333*d
> 
> if choice_1 == '2':
>   l=ltt+0.1*d
> 
> if choice_1 == '3':
>   l=ltt+0.1*d
>   
> #will work on digitizing the graphs to avoid having the user input 
> values at every iteration
> print("your L/Do is ", l/do, "your Do/t is ", do/t)
> print("determine Factor A from ASME Code, Section II, Part D, Subpart 
> 3, Fig G: Geometric Chart for Components Under External or Compressive 
> Loadings")
> a = float(input("Enter A"))
> print("Using Factor “A”, enter the applicable material chart from ASME 
> Code, Section II, Part D, Subpart 3 at the appropriate temperature and 
> determine Factor “B.”")
> b = float(input("Enter B"))
> print("if A is to the left of material graph enter (1), on(2)")
> choice_2 = input("Enter choice(1/2):")  
>   
> if choice_2 == '1':
>allowable_pressure=(3*do/t)
> 
> if choice_2 == '2':
>allowable_pressure=(4*a*el)/(3*do/t)
> 
> print (t, "mm")
> print (allowable_pressure, "Kpa")  
> 
>
>
> - Views.py
> from django.shortcuts import render, redirect
> from django.contrib.auth.decorators import login_required
> from .import forms
>
> @login_required(login_url="/login/")
> def AddMaterial(request):
> form=forms.AddMaterial()
> return render(request, 'webapp/Add_Material.html',{'form':form})
>
> def thickness_l(p,ri,s,e,c):
>return (p*ri)/((2*s*e)+(0.4*p))+c
>
> def thickness_c(p,ri,s,e,c):
>return (p*ri)/((2*s*e)-(0.6*p))+c
>
> def thickness(p,ri,s,e,c):
> if thickness_l(p,ri,s,e,c) < thickness_c(p,ri,s,e,c):
>  return thickness_c(p,ri,s,e,c)
> else:
>  return thickness_l(p,ri,s,e,c)
>
>
> # add equations for external pressure
>
>
> @login_required(login_url="/login/")
> def selection(request, ):
> if request.method == 'POST':
> form=forms.Pressure_choice(request.POST)
> #if choice = internal
> if form = #?
> return redirect('/Internal/')
> #if choice = external
> elif form = #?
> return redirect('/External/')
> else
> return render(request, 'webapp/selection.html',{'form':form})
> 
>
> @login_required(login_url="/login/")
> def Internal_Pressure(request):
> form=forms.Internal_Pressure()
> return render(request, 'webapp/Internal_Pressure.html',{'form':form})
>
> @login_required(login_url="/login/")
> def External_Pressure(request):
> fo

Using Django Sessions

2018-03-23 Thread Derek Zeng
You can have a flag in cart class to mark if things are cleared. Then in the 
__iter__ function, check the flag before getting the keys.

If you do this you also need to add the check in add/remove and others 
accordingly.

-- 
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/a873da51-fe3b-4a75-ba40-7fe6d26fff31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and graphs

2018-03-23 Thread Derek Zeng
What do you mean by Django extension?
You can just use the Networkx in any django view controller and render the 
graph to svg using GraphViz. You can save the svg in database and then 
render it in a webpage.

On Thursday, March 22, 2018 at 3:36:22 PM UTC-4, Mohsen wrote:
>
> Hi all:
>
> I am quite new to Django, and I am looking for Django extensions that 
> support graphs and networks. Would anybody guide me with a tutorial or some 
> hints how we may use Django together with Networkx or SNAP graph library 
> packages.
>
> Many thanks
>
> Mohsen
>

-- 
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/fc058693-64cf-480d-a513-0b6f35531451%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django deployment

2018-03-25 Thread Derek Zeng
You may want to check out http://www.fabfile.org

It's a fairly popular deployment tool for Python projects.

It doesn't really matter what your local dev environment, but for the server 
it's relatively easier if it's Linux.

-- 
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/9a0c05df-6d65-45c4-901f-1dd4c63fc4d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Help: 'django.utils.six.moves' is not a package

2018-04-08 Thread Derek Zeng
I got the following error when running pytest in django. Help is 
appreciated.

This is the test I run

import pytest
from .factories import *

@pytest.mark.django_db
def test_with_client(client):
  PostFactory.create() # if commented out, the error is gone
  response = client.get('/')

  body = str(response.content)
  assert 'Mysite' in body

PostFactory creates a Post object in the database


apps/blog/tests/test_post.py:5 (test_with_client)
client = 
@pytest.mark.django_db
def test_with_client(client):
p = PostFactory.create()

> response = client.get('/')
blog/tests/test_post.py:10: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ 
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:517:
 
in get
response = super().get(path, data=data, secure=secure, **extra)
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:332:
 
in get
return self.generic('GET', path, secure=secure, **r)
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:404:
 
in generic
return self.request(**r)
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:467:
 
in request
response = self.handler(environ)
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:125:
 
in __call__
self.load_middleware()
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/core/handlers/base.py:37:
 
in load_middleware
middleware = import_string(middleware_path)
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/utils/module_loading.py:17:
 
in import_string
module = import_module(module_path)
../../../../.virtualenvs/django/lib/python3.6/importlib/__init__.py:126: in 
import_module
return _bootstrap._gcd_import(name[level:], package, level)
:994: in _gcd_import
???
:971: in _find_and_load
???
:955: in _find_and_load_unlocked
???
:665: in _load_unlocked
???
:678: in exec_module
???
:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ 
from __future__ import absolute_import

import re

from django import http
from django.apps import apps
from django.utils.cache import patch_vary_headers
> from django.utils.six.moves.urllib.parse import urlparse
E ModuleNotFoundError: No module named 'django.utils.six.moves.urllib'; 
'django.utils.six.moves' is not a package
../../../../.virtualenvs/django/lib/python3.6/site-packages/corsheaders/middleware.py:8:
 
ModuleNotFoundError

-- 
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/23957c7e-9aca-4494-a06a-20cbf0fc857b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help: 'django.utils.six.moves' is not a package

2018-04-09 Thread Derek Zeng
I'm using django 2.0.
What exactly is the purpose of django.utils.six.moves module?
I have read the source but don't quite understand. Seems like a poly-fill
of pre-existing libraries like urllib


On Mon, Apr 9, 2018 at 3:47 PM, Avraham Serour  wrote:

> sounds like django 2 removed six and some library you are using still
> hopes it exists.
>
> what django version are you using?
>
> On Mon, Apr 9, 2018 at 3:39 AM, Derek Zeng  wrote:
>
>> I got the following error when running pytest in django. Help is
>> appreciated.
>>
>> This is the test I run
>>
>> import pytest
>> from .factories import *
>>
>> @pytest.mark.django_db
>> def test_with_client(client):
>>   PostFactory.create() # if commented out, the error is gone
>>   response = client.get('/')
>>
>>   body = str(response.content)
>>   assert 'Mysite' in body
>>
>> PostFactory creates a Post object in the database
>>
>>
>> apps/blog/tests/test_post.py:5 (test_with_client)
>> client = 
>> @pytest.mark.django_db
>> def test_with_client(client):
>> p = PostFactory.create()
>>
>> > response = client.get('/')
>> blog/tests/test_post.py:10:
>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>> _ _ _
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:517:
>> in get
>> response = super().get(path, data=data, secure=secure, **extra)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:332:
>> in get
>> return self.generic('GET', path, secure=secure, **r)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:404:
>> in generic
>> return self.request(**r)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:467:
>> in request
>> response = self.handler(environ)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:125:
>> in __call__
>> self.load_middleware()
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/
>> django/core/handlers/base.py:37: in load_middleware
>> middleware = import_string(middleware_path)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/
>> django/utils/module_loading.py:17: in import_string
>> module = import_module(module_path)
>> ../../../../.virtualenvs/django/lib/python3.6/importlib/__init__.py:126:
>> in import_module
>> return _bootstrap._gcd_import(name[level:], package, level)
>> :994: in _gcd_import
>> ???
>> :971: in _find_and_load
>> ???
>> :955: in _find_and_load_unlocked
>> ???
>> :665: in _load_unlocked
>> ???
>> :678: in exec_module
>> ???
>> :219: in _call_with_frames_removed
>> ???
>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>> _ _ _
>> from __future__ import absolute_import
>>
>> import re
>>
>> from django import http
>> from django.apps import apps
>> from django.utils.cache import patch_vary_headers
>> > from django.utils.six.moves.urllib.parse import urlparse
>> E ModuleNotFoundError: No module named 'django.utils.six.moves.urllib';
>> 'django.utils.six.moves' is not a package
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/corsheaders/middleware.py:8:
>> ModuleNotFoundError
>>
>> --
>> 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/ms
>> gid/django-users/23957c7e-9aca-4494-a06a-20cbf0fc857b%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/23957c7e-9aca-4494-a06a-20cbf0fc857b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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/EmfIjFICjyU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to

Re: Help: 'django.utils.six.moves' is not a package

2018-04-10 Thread Derek Zeng
On Tue, Apr 10, 2018, 1:39 AM Babatunde Akinyanmi 
wrote:

>
>
> On Tue, 10 Apr 2018, 02:47 Derek Zeng,  wrote:
>
>> I'm using django 2.0.
>> What exactly is the purpose of django.utils.six.moves module?
>>
> Allowing a code base to be able to run on both python 2 and python 3
>

yeah, but what role does moves module play here? if an old module is not
found here, where does it look for it?


> I have read the source but don't quite understand. Seems like a poly-fill
>> of pre-existing libraries like urllib
>>
>>
>> On Mon, Apr 9, 2018 at 3:47 PM, Avraham Serour  wrote:
>>
>>> sounds like django 2 removed six and some library you are using still
>>> hopes it exists.
>>>
>>> what django version are you using?
>>>
>>> On Mon, Apr 9, 2018 at 3:39 AM, Derek Zeng  wrote:
>>>
>>>> I got the following error when running pytest in django. Help is
>>>> appreciated.
>>>>
>>>> This is the test I run
>>>>
>>>> import pytest
>>>> from .factories import *
>>>>
>>>> @pytest.mark.django_db
>>>> def test_with_client(client):
>>>>   PostFactory.create() # if commented out, the error is gone
>>>>   response = client.get('/')
>>>>
>>>>   body = str(response.content)
>>>>   assert 'Mysite' in body
>>>>
>>>> PostFactory creates a Post object in the database
>>>>
>>>>
>>>> apps/blog/tests/test_post.py:5 (test_with_client)
>>>> client = 
>>>> @pytest.mark.django_db
>>>> def test_with_client(client):
>>>> p = PostFactory.create()
>>>>
>>>> > response = client.get('/')
>>>> blog/tests/test_post.py:10:
>>>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>>> _ _ _ _
>>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:517:
>>>> in get
>>>> response = super().get(path, data=data, secure=secure, **extra)
>>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:332:
>>>> in get
>>>> return self.generic('GET', path, secure=secure, **r)
>>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:404:
>>>> in generic
>>>> return self.request(**r)
>>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:467:
>>>> in request
>>>> response = self.handler(environ)
>>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:125:
>>>> in __call__
>>>> self.load_middleware()
>>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/core/handlers/base.py:37:
>>>> in load_middleware
>>>> middleware = import_string(middleware_path)
>>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/utils/module_loading.py:17:
>>>> in import_string
>>>> module = import_module(module_path)
>>>> ../../../../.virtualenvs/django/lib/python3.6/importlib/__init__.py:126:
>>>> in import_module
>>>> return _bootstrap._gcd_import(name[level:], package, level)
>>>> :994: in _gcd_import
>>>> ???
>>>> :971: in _find_and_load
>>>> ???
>>>> :955: in _find_and_load_unlocked
>>>> ???
>>>> :665: in _load_unlocked
>>>> ???
>>>> :678: in exec_module
>>>> ???
>>>> :219: in _call_with_frames_removed
>>>> ???
>>>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>>> _ _ _ _
>>>> from __future__ import absolute_import
>>>>
>>>> import re
>>>>
>>>> from django import http
>>>> from django.apps import apps
>>>> from django.utils.cache import patch_vary_headers
>>>> > from django.utils.six.moves.urllib.parse import urlparse
>>>> E ModuleNotFoundError: No module named 'django.utils.six.moves.urllib';
>>>> 'django.utils.six.moves' is not a package
>>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/corsheaders/middleware.py:8:
>>>> ModuleNotFoundError
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users"

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

2017-09-02 Thread Derek Zeng
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!

-- 
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/cf286bfb-2879-46d5-95b6-05dc56fc384f%40googlegroups.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
b/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.py",
 line 98, in render_compressed
compressor = self.get_compressor(context, kind)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/compressor/templatetags/compress.py",
 line 39, in get_compressor
content=self.get_original_content(context), context=context)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/compressor/templatetags/compress.py",
 line 123, in get_original_content
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/templatetags/static.py",
 line 105, in render
url = self.url(context)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/templatetags/static.py",
 line 102, in url
return self.handle_simple(path)
  File 
"/Users/coderek/Documents/projects/py3.5/lib/python3.5/site-packages/django/templatetags/static.py",
 line 116, in handle_simple
from django.contrib.staticfiles.storage import staticfiles_storage
  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'



On Sunday, September 3, 2017 at 12:11:03 AM UTC-4, James Schneider wrote:
>
>
>
> 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/9a2615e7-1a79-465e-93ae-f7572f83de90%40googlegroups.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-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
> <https://groups.google.com/d/msgid/django-users/CABgH4Js1z0e7yypGD4f7z_eKbMrYWQEMT9viCSCshA1ROhMA_A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> 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-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.