This is the code we use the generate certificates at edX.
This script will continuously monitor an xqueue queue for the purpose of generating a course certificate for a user.
mkvirtualenv certificates
git clone git@github.com:edx/edx-certificates
git clone git@github.com:edx/edx-certificates-internal
pip install -r edx-certificates/requirements.txt
~/.boto
file in your home directory[Credentials]
aws_access_key_id = *****
aws_secret_access_key = ****
Or for edX use the boto.example
in the edx-certificates-interal repo:
cp edx-certificates-internal/boto.example ~/.boto
export CERT_PRIVATE_DIR=/path/to/edx-certificates-internal
cd edx-certificates
python create_pdfs.py -c some/course/id -n Guido
some/course/id should be a valid course id found in `edx-certificates-internal/cert-data.yml
This script will continuously monitor a queue for certificate generation, it does the following:
A global exception handler will catch any error during the certificate generation process and post a result back to the LMS via the xqueue server indicating there was a problem.
optional arguments:
-h, --help show this help message and exit
--aws-id AWS_ID AWS ID for write access to the S3 bucket
--aws-key AWS_KEY AWS KEY for write access to the S3 bucket
Logging is setup similar to Django logging, logsettings.py will generate a configuration dict for logging where in a production environment all log messages are sent through rsyslog
To run the test suite:
Configure your credential information in settings.py
. You will need to specify:
CERT_KEY_ID = # The id for the key which will be used by gpg to sign certificates
CERT_AWS_ID = # Amazon Web Services ID
CERT_AWS_KEY = # Amazon Web Services Key
CERT_BUCKET = # Amazon Web Services S3 bucket name
It is also acceptable to leave the AWS KEY and ID values as none and instead use .boto file or run this code from a server that has an IAM role that gives it write access to the bucket in the configuration.
To run all of the tests from the certificates
directory, run:
nosetests
Note that this will run tests that will fail unless AWS credentials are setup. To run just the tests for local on-disk publishing run:
nosetests tests.gen_cert_test:test_cert_gen
Troubleshooting: If tests fail with errors, try running:
pip install -r requirements.txt
to install necessary requirements.
In addition, you must install gpg
. See gnugp
for instructions.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。