Most Powerful Open Source ERP

How to use Django stack in Theia

How to use Django stack in Theia
  • Last Update:2022-07-22
  • Version:002
  • Language:en

Agenda

  1. Set up Django environment in Theia
  2. Verification

This tutorial will teach you how to install your Django development environment and how to set up Django in Theia.

Prerequisites

You must have a Django deployed: How to deploy Django stack in Theia

Set up Django environment in Theia

Theia being a cloud based IDE, a server launched on it will be directly accessible by an ipv6.
In Django, the default ip is localhost, but it's not possible in the Cloud.
You have to add the ipv6 displayed by the connections parameters in the variable ALLOW_HOSTS in settings.py file of the Django project.

ALLOWED_HOSTS=['< my_ipv6 >']

Verification

To launch the server, run:

$ python manage.py runserver -6 [$IPV6_SLAPRUNNER]:8000

Note: don't forget to add -6 option to use Theia's ipv6 and the "[$IPV6_SLAPRUNNER]:port" couple.

Verification

To access your Django website, copy and go to the link that Django print in your terminal.

If you don't have IPv6 on your machine you can still check that your Django website is up from inside Theia with:

$ curl http://[$IPV6_SLAPRUNNER]:8000

Note: if you do not have IPv6, you can install IPv6 on your machine or request a CDN.