Edit: I need to clarify, I want to import sage as a library to use in Python scripts OUTSIDE of the sage shell because I need it to run as a server on Django.
Do I have to compile sage from source?
I have been trying to use sage for my python scripts.
Code looks like this:
#!/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
from sage.all import *
def index(request):
querystring = request.GET.get('querystring')
return HttpResponse(querystring)
# Create your views here.
But I'm getting an error : no module named sage.all
I haven't had trouble running
#!/usr/bin/env sage -python
import sys
from sage.all import *
var('x')
print integrate(x,x)
print latex(integrate(sin(x),x))
From the command line with ./sage -python /path/to/script.py
So I don't understand why I can't import sage...
The directory "sage" IS in the python path, it's right next to the views.py file I'm trying to use it in, I've tried putting it in various different places, or appending it to the sys.path, to no avail. Any help is GREATLY appreciated, this is a very important project. I am trying to import Sage into a Django project.
Edit: I am NOT running the second one with ./sage -python, instead I am running it as views.py on my Django localhost server.