advfe-unified-workspace

Advanced Front End: Updating settings.py

We have a couple of things to do here, then we are ready to run the application.


In settings.py:

  1. Set DEBUG to the value of the DEBUG environment variable and update ALLOWED_HOSTS to include the ALLOWED_HOST environment variable added to your env.py file

    updated debug and allowed hosts variables in an env.py file

Removing most of the CORS code

Now that we have the two parts of our application within the same workspace, the CORS issues with the original separate projects are no longer a problem. This is because both parts of the project will come from the same base URL. Therefore, we can remove most of the code in the Django project relating to CORS.

In your settings.py file, update the CORS_ALLOWED_ORIGINS list to contain only the CLIENT_ORIGIN environment variable.

Before:

CORS_ALLOWED_ORIGINS list containing two environment variables

After:

CORS_ALLOWED_ORIGINS list containing only CLIENT_ORIGIN

Up Next

That’s all the modifications done, so let’s get our development environment up and running.