startproject fails with cert error when assigning a starter template. Any workaround?

Hi all. Some of you may remember me from the Django IRC channel. I used to be pretty active there.

I’m trying to start up a new Django project using a project template as documented here:

django-admin startproject --template= test_project

This used to work fine when I last used it, quite some time ago, but over time folks have tightened up their security and now it fails with a cert error:

CommandError: couldn't download URL to <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>

So, first off, I’m not sure where it’s hoping to find this cert and if it’s something I should be adding.

Or alternately, as I google around I see some projects let you pass an argument to say it’s a trusted source, but right now, looking at the startproject source, it doesn’t appear to have such an argument, or even make a check for any cert.


I’m not able to recreate this with any file that I have tried. (Granted, every repo I’ve tried this with is public. I’ve never tried this with a private repo.)

But yes, I agree that I don’t see any facility being used by the download function that would allow for a key exchange to be used. You’re probably going to be best off downloading the file first and then referencing it in the startproject command.

(The alternative would be to replace the startproject command to use your own version of the TemplateCommand class that uses something like the requests library to do the download.)

Thanks Ken, I appreciate you looking into it. For whatever it’s worth, I was looking at resurrecting my old Tango starter kit, so the full un-obfuscated command would be startproject --template= test_project

I’m not sure it’s worth it to try to sort it out, though. I suspect the Django community in general wasn’t as enamored with project templates as I was and has moved on to other ways of doing this.

It’s the URL that I think isn’t correct any more.

If you go to your repo and look at the link that github provides for downloading as a zip, you’ll see:

When I use that as the URL, the startproject command works.

Ken, you may be a genius