58 lines
1.3 KiB
Python
58 lines
1.3 KiB
Python
# same settings as production but with debug to true and ssl redirects off
|
|
# useful for running vs code or python debugger
|
|
# needed to run local Django dev server over http
|
|
|
|
|
|
|
|
'''
|
|
TO START DEV SERVER
|
|
|
|
run dev server to access site over http:
|
|
set backend env DEV_MODE var:
|
|
DEV_MODE=True
|
|
|
|
(if you haven't set up these servers yet, you can ignore the rest of the steps and just run:
|
|
|
|
DJANGO_SETTINGS_MODULE=main_project.dev_settings python manage.py runserver (linux)
|
|
|
|
or
|
|
|
|
set DJANGO_SETTINGS_MODULE=main_project.dev_settings&& python -m manage runserver (windows cmd)
|
|
|
|
or
|
|
|
|
$env:DJANGO_SETTINGS_MODULE = "main_project.dev_settings"; python -m manage runserver (windows powershell)
|
|
|
|
|
|
|
|
)
|
|
|
|
stop nginx and gunicorn
|
|
sudo systemctl stop nginx
|
|
sudo systemctl stop gunicorn
|
|
sudo systemctl stop gunicorn.socket
|
|
|
|
in your browser, open dev tools
|
|
clear cache and cookie data in dev tools console (otherwise any previous http redirects will still be in affect)
|
|
|
|
start dev server:
|
|
DJANGO_SETTINGS_MODULE=main_project.dev_settings python manage.py runserver
|
|
|
|
|
|
make sure you can access the frontend at
|
|
127.0.0.1:8080
|
|
and the backend at
|
|
127.0.0.1:8000/api/
|
|
'''
|
|
|
|
from .settings import *
|
|
|
|
# for development
|
|
DEBUG = True
|
|
|
|
SECURE_SSL_REDIRECT=False
|
|
SESSION_COOKIE_SECURE=False
|
|
CSRF_COOKIE_SECURE=False
|
|
SECURE_REDIRECT_EXEMPT = ['^']
|
|
|
|
print('\nDEV MODE: ' + str(env("DEV_MODE")) + '\n') |