Create Project
Create Directory & Project
mkdir projectdir
django-admin startproject theproject projectdir
settings.py - /path/projectdir/theproject
...
ALLOWED_HOSTS = ['*']
...
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
...
]
...
STATIC_ROOT = BASE_DIR / '/static/'
STATIC_URL = 'static/'
...
CORS_ALLOW_ALL_ORIGINS = True # if required
CSRF_COOKIE_DOMAIN = None
CSRF_TRUSTED_ORIGINS = ['https://django.activetechsystems.com']
Run Server
cd /path/projectdir
python3 manage.py runserver 0.0.0.0:8000
Browse
https://django.activetechsystems.com
Goes To Django Page
Keep Project Running
crontab -e
@reboot cd /var/www/activetech/apps/django && /usr/bin/nohup python3 manage.py runserver 0.0.0.0:8000 > /dev/null 2>&1
Kill Port 8000 Process
sudo lsof -t -i tcp:8000 | xargs kill -9