You can't do what your trying to do.
fedorqui's answer shows how to read environment variables from Python, but that won't help you.
First, you're just starting the shell script and immediately assuming it's already done its work, when it may not even have finished launching yet. You might get lucky and have it work sometimes, but not reliably. You need to wait for the Popen object (which also means you need to store it in a variable)—or, even more simply, call it (which waits until it finishes) instead of just kicking it off.
And you probably want to check the return value, or just use check_call, so you'll know if it fails.
Meanwhile, if you fix that, it still won't do you any good. export doesn't export variables to your parent process, it exports them to your children.
If you want to pass a value back to your parent, the simplest way to do that is by writing it to stdout. Then, of course, your Python code will have to read your output. The easiest way to do that is to use check_output instead of check_call.
Finally, I'm pretty sure you wanted to actually run openssl and capture its output, not just set output to the literal string openssl x509 -in $userpem -noout -text. (Especially not with single quotes, which will prevent $userpem from being substituted, meaning you looked it up for nothing.) To do that, you need to use backticks or $(), as you did in the previous line, not quotes.
So:
#!/bin/bash
userpem=$(egrep "CN=$1/" index.txt|awk '{print $3}').pem
output=$(openssl x509 -in $userpem -noout -text)
echo $output
And:
def info(request, benutzername):
os.chdir("/var/www/openvpn/examples/easy-rsa/2.0/keys")
output = subprocess.check_output(["/var/www/openvpn/examples/easy-rsa/2.0/keys/getinfo.sh",benutzername])
return HttpResponse(output)
As a side note, os.chdir is usually a bad idea in web servers. That will set the current directory for all requests, not just this one. (It's especially bad if you're using a semi-preemptive greenlet server framework, like something based on gevent, because a different request could chdir you somewhere else between your chdir call and your subprocess call…)
var = os.getenv('variablename')orvar = os.environ['variablename']