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.

  1. In your settings.py file remove the line containing the import re

    import re shown being removed from a settings.py file

  2. Remove all the CORS code, leaving only the CORS_ALLOWED_ORIGINS list

    Before:

    two if statements relating to client origin environment variables

    After:

    a settings.py file with no if statements relating to client origin environment variables

Up Next

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