> > Anyone?? > > As you know, I've already had several useless ideas for you on another forum :( but here is another one. Is Sage itself in your regular path? By that I mean that in my PATH I have
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/usr/texbin:/Applications/MathApps: where the last one is where I have a symbolic link to my Sage installation. lrwxr-xr-x 1 me admin 87 Oct 10 2013 sage -> /Users/.../Sage-5.12-OSX-64bit-10.6.app/Contents/Resources/sage/sage I was able to successfully do what you wanted, though, with a file #!/usr/bin/env sage -python from sage.all import * print permutations(5) Now, I just executed that file as a Unix file. When you are executing yours as a *Python* file, I get the same error as you. $ python views.py Traceback (most recent call last): File "views.py", line 3, in <module> from sage.all import * ImportError: No module named sage.all Solution? I suppose either find a way to have Django execute it as a Unix file (not Python), or just run your entire project with "sage -python" instead of your system Python! Other people who actually know what they are talking about: please respond! > On Tuesday, July 8, 2014 2:53:33 PM UTC-4, Jole Bradbury wrote: >> >> I have a Django project with >> views.py: >> >> #!/usr/bin/env sage -python >> >> from django.shortcuts import render >> from django.http import HttpResponse >> import sys >> from django.http import HttpRequest >> from django.template import RequestContext, loaders >> sys.path.append('/Users/Jole/Desktop/django_proj/mysite/sage/src/bin') >> sys.path.append('/Users/Jole/Desktop/django_proj/mysite/sage/') >> from sage.all import * >> >> >> def index(request): >> >> querystring = request.GET.get('querystring') >> >> return HttpResponse(querystring) >> >> >> As you can see I am trying to import sage as a library into my Python >> document so I can do some sage computations. >> >> Unfortunately, when I fire up my Django server on localhost, I get: No >> module named sage.all >> >> As an error message. As you can see I have already tried appending to the >> path. My Python Path includes sage and I can see this on my Django page, >> however my "PATH" is >> PATH >> >> '/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin' >> >> >> >> According to the Django server output. I'm not sure if this could be the >> problem. Any help would be *greatly appreciated.* >> >> >> -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.