How to setup SSL on a local django server to test a facebook app?

I've configured my local machine's HOSTS configuration to access the local server ( @ 127.0.0.1 ) whenever I hit http://www.mydomain.com on the browser.

And I was using this to interact with facebook's graph api to build my app. But now facebook requires us to have an HTTPS url or rather an SSL secured url to interact with their api.

So the question is -> How do I setup SSL on a local django server ?

Answers


Short answer is you'll need to setup a proper webserver on your development machine. Use whichever one (Apache, nginx, cherokee etc) you're most familiar with.

Longer answer is that the django development server (manage.py runserver) isn't designed to do SSL etc and the effort to make it do so is likely greater than you'd want to spend.

See discussions of this passim on the django-users list: http://groups.google.com/group/django-users/browse_thread/thread/9164126f70cebcbc/f4050f6c82fe1423?lnk=gst&q=ssl+development+server#f4050f6c82fe1423


Not to necro a thread, but I found this tool to be extremely easy to use.

It's a premade django application with very simple install instructions.

You can add a certified key once it is installed simply by running:

python manage.py runsslserver --certificate /path/to/certificate.crt --key /path/to/key.key

I hope this helps any passer-by who might see this.


With django-extensions you can run the following command:

python manage.py runserver_plus --cert certname

It will generate a (self-signed) certificate automatically if it doesn't exist. Almost too simple.

You just need to install the following dependencies:

pip install django-extensions
pip install Werkzeug
pip install pyOpenSSL

Now, as Ryan Pergent pointed out in the comments, you lastly only need to add 'django_extensions', to your INSTALLED_APPS and should be good to go.

I used a tunnel before, which worked, but this is much easier and comes with many other commands.


Need Your Help

how to add cursor type on a table row using javascript?

javascript

var tbl = document.getElementById(TABLE_NAME);

Is a single thread guaranteed to execute a Servlet and its Filters?

java java-ee tomcat servlets servlet-filters

I already know that most implementations use a single thread, but is there anything in the specification that implies the single thread? I remember reading about distributed app servers which use a