I think you need to create various settings.py (base_settings.py, local_settings.py, production_settings.py). And in your settings.py do something like this:
import socket if socket.gethostname()=="Raouf-PC": from local_settings import *
Change "Raouf-PC" to the host name of your PC.
P: S: I am using Windows 10.
After that, place the data below in the file production_settings.py and save. Then clear your browser’s cache and go to your site on the development server.
SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True SECURE_SSL_REDIRECT = True
If the above does not meet your needs, then in your local_settings.py file, paste the data below, save and clear your browser’s cache and go to your website.
SESSION_COOKIE_SECURE = False CSRF_COOKIE_SECURE = False SECURE_SSL_REDIRECT = False
Note: at the beginning of production_setttings.py and local_settings.py put:
from base_settings.py import *
Your basic settings should contain "settings" that will be used on both the local and production server so that you do not repeat it every time.
P: S If my answer is accepted, I will devote it to the good people who helped me anyway. This is my first answer to the question. I hope to do more in the future. :)
Yoyo
source share