how can i add ssl certificate to my django website??

I have domain on tmdhosting and pointing to digitalocean host server. I have django website and now after deploy i want to secure it by ssl . but i faced many problems and errors. so how can i add ssl to my web?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


In order to give you a solid straight forward answer, you must give a more detailed description of your setup.

However, in general you don’t deal with SSL in your application. Instead, it is normal practice to handle SSL with a dedicated HTTP-server program, such as Nginx or Apache.

By using DigitalOcean’s App Platform-solution all of that is handled for you.

On the contrary, if you are running your own Droplet with, let’s say, Ubuntu 20.04 and Apache you want to do the following:

  1. Determine what port your Django app is listening on (default is localhost:8000).
  2. Setup a virtual host on Apache for your domain. (Don’t bother with SSL yet!.)
  3. Configure the virtual host frem step 2 to reverse proxy all the incoming requests to your Django app (e.g. localhost:8000).
  4. Test that the setup works as expected. By now you should be able to communicate with your Django app over http://your-domain
  5. Now, wrap it up by adding SSL to your Apache virtual host with Let’s Encrypt and you should then be able to access your Django app over SSL https://your-domain

Good luck! :)