From a468778ed67bd467b9a1380a803ebbcf9deee5f7 Mon Sep 17 00:00:00 2001 From: Andreas Burbach <andreas.burbach@uni-duesseldorf.de> Date: Thu, 2 Jun 2022 15:41:02 +0000 Subject: [PATCH] Update social_network/README.md --- social_network/README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/social_network/README.md b/social_network/README.md index cb794e7..67f68af 100644 --- a/social_network/README.md +++ b/social_network/README.md @@ -25,7 +25,19 @@ If you not have already created a django python project, [create](https://docs.d This will create a **mysite** directory in your current directory. Open the **mysite** directory and open the **settings.py**. -Add *'the_social_network'* to **INSTALLED_APPS** and save the file. +We need to make some changes in this file: +- Add ```import os``` at the very first begining of the file. +- Add ```ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS", "*").split(",")``` where ```ALLOWED_HOSTS = []``` +- Add ```CORS_ORIGIN_ALLOW_ALL = bool(os.environ.get("CORS_ORIGIN_ALLOW_ALL", True))```directly after ```ALLOWED_HOSTS``` +- Add ```'corsheaders', 'the_social_network', 'rest_framework', 'rest_framework.authtoken'``` to **INSTALLED_APPS** +- Add ```'corsheaders.middleware.CorsMiddleware'``` at the start of **MIDDLEWARE** +- Add ```# REST Framework settings + REST_FRAMEWORK = { + 'DEFAULT_AUTHENTICATION_CLASSES': [ + 'rest_framework.authentication.TokenAuthentication', + ], + }``` +after ```STATIC_URL = '/static/'``` Next open the urls.py and add the following lines to your **urlpatterns** -- GitLab