django vars in ram

Viewed 384

I am implementing a really lightweight Web Project, which has just one page, showing data in a diagram. I use Django as a Webserver and d3.js as plotting routine for this diagram. As you can imagine, there are just a few simple time series which have to be responded by Django server, so I was wondering if I simply could hold this variable in ram. My first test was positive, I had something like this in my views.py:

X = np.array([123,23,1,32,123,1])

@csrf_exempt
def getGraph(request):
    global X
    return HttpResponse(json.dumps(X))

Notice, X is updated by another function every now and then, but all user access is read-only. Do I have to deal with

  1. security issues by defining a global variable?
  2. inconsistencies in general?

I found a thread discussing global variables in Django, but in that case, the difficulty is of handling multiple write-access.

To answer potential questions on why I don't want store data in database: All data I got in my X is already stored in a huge remote database and this web app just needs to display data.

1 Answers
Related